首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将Artifactory配置为巧克力缓存?我在安装软件包时得到404

如何将Artifactory配置为巧克力缓存?我在安装软件包时得到404
EN

Stack Overflow用户
提问于 2021-02-04 09:53:37
回答 2查看 1.1K关注 0票数 1

艺术版本: 6.16.2 rev 61602900,Arti城Pro许可证。

在Artifactory中,我添加了一个具有以下设置的远程存储库:

  • 包装类型:NuGet
  • 存储库密钥:chocolatey-remote
  • 网址:https://chocolatey.org/
  • 测试:成功连接到服务器
  • 存储库布局:nuget-default
  • 包括模式:**/*
  • 下载上下文路径:api/v2/package
  • NuGet源上下文路径:api/v2
  • NuGet v3源URL:(空)

截图:

在主机上,我配置了巧克力源:

代码语言:javascript
运行
复制
choco source add --name=artifactory --source=https://<ARTIFACTORY>/api/nuget/chocolatey-remote --user=***REDACTED*** --password=***REDACTED***
choco source disable --name chocolatey
choco source list

输出:

代码语言:javascript
运行
复制
PS C:\Users\vagrant> choco source list     
Chocolatey v0.10.15
artifactory - https://<ARTIFACTORY>/api/nuget/chocolatey-remote (Authenticated)| Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
chocolatey [Disabled] - https://chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.

在运行choco info <PACKAGE>时,我会得到一个预期的结果:

代码语言:javascript
运行
复制
PS C:\Users\vagrant> choco info vlc   
Chocolatey v0.10.15
vlc 3.0.12
 Title: VLC media player | Published: 1/18/2021
 Number of Downloads: 7848809 | Downloads for this version: 252349
 Package url
 Chocolatey Package Source: n/a
 Package Checksum: 'GNbCKwr6nqOoJc/DX/+riBbXyncp1wV3xOAyYTaOgdls+SiKmvUXoIVXUBGTswQMPIc1tKSdYy+KvuVXb4jliQ==' (SHA512)
 Tags: vlc foss cross-platform multimedia audio video mp3 dvd avi media player admin
 Software Site: http://www.videolan.org/vlc/
 Software License: http://www.videolan.org/legal.html
 Summary: VLC Media Player
 Description: VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVD, Audio CD, VCD, and various streaming protocols.
(etc)

当我安装软件包时,我得到404:

代码语言:javascript
运行
复制
PS C:\Users\vagrant> choco install vlc
Chocolatey v0.10.15
Installing the following packages:
vlc
By installing you accept licenses for the packages.
vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found
vlc package files install completed. Performing other installation steps.
The install of vlc was NOT successful.
vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - vlc (exited 1) - vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found

我是C:\ProgramData\chocolatey\logs\chocolatey.log

代码语言:javascript
运行
复制
2021-02-04 09:42:36,839 764 [DEBUG] - XmlConfiguration is now operational
2021-02-04 09:42:36,870 764 [INFO ] - ============================================================
2021-02-04 09:42:36,997 764 [INFO ] - Chocolatey v0.10.15
2021-02-04 09:42:36,997 764 [DEBUG] - Chocolatey is running on Windows v 10.0.17763.0
2021-02-04 09:42:36,997 764 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2021-02-04 09:42:36,997 764 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2021-02-04 09:42:37,010 764 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install vlc
2021-02-04 09:42:37,010 764 [DEBUG] - Received arguments: install vlc
2021-02-04 09:42:37,041 764 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2021-02-04 09:42:37,041 764 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2021-02-04 09:42:37,041 764 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2021-02-04 09:42:37,088 764 [DEBUG] - Performing validation checks.
2021-02-04 09:42:37,088 764 [DEBUG] - Global Configuration Validation Checks:
2021-02-04 09:42:37,088 764 [DEBUG] -  - Package Exit Code / Exit On Reboot = Checked
2021-02-04 09:42:37,088 764 [DEBUG] - System State Validation Checks:
2021-02-04 09:42:37,088 764 [DEBUG] -  Reboot Requirement Checks:
2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Computer Rename = Checked
2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Component Based Servicing = Checked
2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Windows Auto Update = Checked
2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending File Rename Operations = Checked
2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Windows Package Installer = Checked
2021-02-04 09:42:37,108 764 [DEBUG] -  - Pending Windows Package Installer SysWow64 = Checked
2021-02-04 09:42:37,108 764 [INFO ] - 2 validations performed. 2 success(es), 0 warning(s), and 0 error(s).
2021-02-04 09:42:37,108 764 [DEBUG] - The source 'https://<ARTIFACTORY>/api/nuget/chocolatey-remote' evaluated to a 'normal' source type
2021-02-04 09:42:37,108 764 [DEBUG] - 
NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
2021-02-04 09:42:37,119 764 [DEBUG] - Configuration: CommandName='install'|
CacheLocation='C:\Users\vagrant\AppData\Local\Temp\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://<ARTIFACTORY>/api/nuget/chocolatey-remote'|
SourceType='normal'|Debug='False'|Verbose='False'|Trace='False'|
Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='vlc'|AllVersions='False'|
SkipPackageInstallProvider='False'|PackageNames='vlc'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.17763.0'|
Information.PlatformName='Windows Server 2016'|
Information.ChocolateyVersion='0.10.15.0'|
Information.ChocolateyProductVersion='0.10.15'|
Information.FullName='choco, Version=0.10.15.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='False'|
Information.UserName='vagrant'|
Information.UserDomainName='VAGRANT-I7ND05O'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\Users\vagrant'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'| 
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|Proxy.BypassOnLocal='True'|
2021-02-04 09:42:37,119 764 [DEBUG] - _ Chocolatey:ChocolateyInstallCommand - Normal Run Mode _
2021-02-04 09:42:37,119 764 [INFO ] - Installing the following packages:
2021-02-04 09:42:37,119 764 [INFO ] - vlc
2021-02-04 09:42:37,119 764 [INFO ] - By installing you accept licenses for the packages.
2021-02-04 09:42:37,166 764 [DEBUG] - Using 'https://<ARTIFACTORY>/api/nuget/chocolatey-remote'.
2021-02-04 09:42:37,338 764 [DEBUG] - - Supports prereleases? 'True'.
2021-02-04 09:42:37,338 764 [DEBUG] - - Is ServiceBased? 'True'.
2021-02-04 09:42:37,544 764 [DEBUG] - Package 'vlc' found on source 'https://<ARTIFACTORY>/api/nuget/chocolatey-remote'
2021-02-04 09:42:37,589 764 [INFO ] - [NuGet] Attempting to resolve dependency 'chocolatey-core.extension (= 1.3.3)'.
2021-02-04 09:42:37,666 764 [ERROR] - vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found
2021-02-04 09:42:37,666 764 [INFO ] - vlc package files install completed. Performing other installation steps.
2021-02-04 09:42:37,666 764 [DEBUG] - No package information as package is null.
2021-02-04 09:42:37,682 764 [DEBUG] - No package information to save as package is null.
2021-02-04 09:42:37,682 764 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers...
2021-02-04 09:42:37,682 764 [ERROR] - The install of vlc was NOT successful.
2021-02-04 09:42:37,682 764 [ERROR] - vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found
2021-02-04 09:42:37,682 764 [WARN ] -
Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log). 
2021-02-04 09:42:37,682 764 [INFO ] -  
2021-02-04 09:42:37,697 764 [ERROR] - Failures
2021-02-04 09:42:37,697 764 [ERROR] -  - vlc (exited 1) - vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found
2021-02-04 09:42:37,697 764 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2021-02-04 09:42:37,732 764 [DEBUG] - Exiting with 1

如果没有404,我怎么才能得到一堆巧克力呢?

我已经下载了Artifactory日志,并对choco进行了改进。

代码语言:javascript
运行
复制
$ grep choco *.log
access.log:2021-02-04 15:31:38,164 [DENIED DOWNLOAD] chocolatey-remote-cache:vlc.3.0.12.nupkg  for client : NA / 91.180.197.91.
artifactory.log:2021-02-04 10:57:28,154 [http-nio-8081-exec-992] [INFO ] (o.a.u.r.s.a.c.r.UpdateRepositoryConfigService:64) - Updating repository chocolatey-remote
artifactory.log:2021-02-04 14:36:56,347 [http-nio-8081-exec-1053] [INFO ] (o.a.u.r.s.a.c.r.UpdateRepositoryConfigService:64) - Updating repository chocolatey-remote
request.log:20210204153137|124|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote|HTTP/1.0|200|0
request.log:20210204153137|4|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote/$metadata|HTTP/1.0|200|0
request.log:20210204153138|128|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote/Packages()|HTTP/1.0|200|0
request.log:20210204153138|16|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote/Download/vlc/3.0.12|HTTP/1.0|404|0

这行[DENIED DOWNLOAD] chocolatey-remote-cache:vlc.3.0.12.nupkg看起来与这个问题相关,但我需要一位艺术专家来帮助我理解它的含义。

我运行的choco命令与@yahavi完全一样,如下所示:

代码语言:javascript
运行
复制
PS C:\Users\vagrant> choco install vlc --source=https://<ARTIFACTORY>/api/nuget/chocolatey-remote --user=***REDACTED*** --password=***REDACTED***
Chocolatey v0.10.15
Installing the following packages:
vlc
By installing you accept licenses for the packages.
vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found
vlc package files install completed. Performing other installation steps.
The install of vlc was NOT successful.
vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - vlc (exited 1) - vlc not installed. An error occurred during installation:
 The remote server returned an error: (404) Not Found. Not Found

作为一个健全的检查,我也做了choco install vlc --source=https://chocolatey.org/api/v2/,这是有效的。这排除了巧克力方面的任何问题,这无疑是Artifactory的一个问题。

EN

回答 2

Stack Overflow用户

发布于 2022-05-26 10:00:14

我也有这个问题,我注意到在常见问题中提到的唯一URL是https://community.chocolatey.org/将配置更改为为我修复的配置。

我没有检查是否有其他受支持的URL,这可能取决于您想要的包吗?我继承的配置设置为:https://www.chocolatey.org,我注意到您的配置设置为https://chocolatey.org,但这两个配置都不适合我。

票数 1
EN

Stack Overflow用户

发布于 2021-02-04 12:29:50

尝试将NuGet v3 Feed URL设置为默认值:https://api.nuget.org/v3/index.json

我们在测试中使用Artifactory作为巧克力的缓存机制。由于我们在install命令中添加了连接详细信息,所以用法与您的不太一样:

代码语言:javascript
运行
复制
choco install vlc -s <jfrog-url>/api/nuget/chocolatey-remote -u <username> -p <password>

要获得更多信息,欢迎您阅读我的博客:https://jfrog.com/blog/artifactory-as-a-caching-mechanism-for-package-managers/

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66043223

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档