推送到回购时的 Artifactory "System cannot find the path"

Artifactory "System cannot find the path" when pushing to repo

我使用免费套餐帐户在 Artifactory 中设置了一个 NuGet 存储库。我按照“快速设置”说明注册了 API 键,添加了源,并推送了我的第一个包。当我以自己的身份登录到我的构建机器时,这一切都很容易。

接下来,我决定将它集成到我的 GitLab 管道中,这样我就可以将我的包作为部署阶段的一部分进行推送。我使用了相同的命令,但出现“系统找不到指定路径”的错误。我几乎可以肯定问题与使用 Artifactory 源有关,因为我可以将源 URL 交换为本地回购路径并且命令成功。

这是我的命令 运行:

nuget push MyApp.1.0.0.nupkg -Source https://myco.jfrog.io/artifactory/api/nuget/my-repo -ApiKey user:pass

运行 我的 GitLab 管道作业的结果是:

Pushing MyApp.1.0.0.nupkg to 'https://myco.jfrog.io/artifactory/api/nuget/my-repo/'...
error: The system cannot find the path specified.

哪些机器变量或状态会阻止在机器级别推送到 Artifactory?还是完全是其他问题?

我怀疑这是由于 API 密钥参数与 username:password(加密)一起使用而发生的冲突。即使我们没有为源配置 API 密钥,NuGet 客户端也能够比较源 URL 的现有凭据的配置文件并自动获取它。

我分享了未设置 API 密钥时的部署流程。

$ nuget push serilog.2.9.2-dev-01154.nupkg -Source http://nuget-test-artifactory.com/artifactory/api/nuget/test-nuget/ WARNING: No API Key was provided and no API Key could be found for 'http://nuget-test-artifactory.com/artifactory/api/nuget/test-nuget/'. To save an API Key for a source use the 'setApiKey' command. Pushing serilog.2.9.2-dev-01154.nupkg to 'http://nuget-test-artifactory.com/artifactory/api/nuget/test-nuget/'... PUT http://nuget-test-artifactory.com/artifactory/api/nuget/test-nuget/ MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/15.0/bin'. Using credentials from config. UserName: admin Created http://nuget-test-artifactory.com/artifactory/api/nuget/test-nuget/ 6160ms Your package was pushed.

因此,如果您已经通过以下命令执行 username:password 设置了源,

nuget sources Add -Name Artifactory -Source http://ARTIFACTORY_HOSTNAME/artifactory/api/nuget/test-nuget -username admin -password <ENCRYPTED_PASSWORD>

考虑执行以下命令来执行部署(自定义布局),

nuget push <PACKAGE> -Source http://ARTIFACTORY_HOSTNAME/artifactory/api/nuget/test-nuget/<PATH_TO_FOLDER>

如果您想使用默认布局执行部署,则只需执行以下命令即可。

nuget push <PACKAGE_NAME> -Source Artifactory