Gitlab Runner 403禁止在Nuget Push上出错

时间:2018-10-11 07:49:20

标签: continuous-integration gitlab gitlab-ci gitlab-ci-runner

我正在尝试准备一个CI管道,该管道将打包并在每次提交时将.dll推送到我的自定义nuget服务器。

.gitlab-ci.yml:

image: microsoft/dotnet:latest

stages:
  - build
  - pack
  - push
variables:
  project: "GitlabCITest"

before_script:
  - "dotnet restore"
  - "ls -al /builds/test/gitlabcitest/GitlabCITest/nuget.exe"

build:
  stage: build
  variables:
    build_path: "./"
  script:
    - "dotnet build"

pack:
  stage: pack
  script:

    - "cd GitlabCITest"
    - "mkdir tesdosyası"
    - "dotnet pack GitlabCITest.csproj"
    - "ls -al /builds/test/gitlabcitest/GitlabCITest/bin/Debug"
    - "dotnet nuget push --force-english-output /builds/test/gitlabcitest/GitlabCITest/bin/Debug/*.nupkg -s MyCustomNugetServerAddress -k MyApiKey"

当它运行时,我在推送作业中收到403禁止的错误。

错误日志:

$ ls -al /builds/test/gitlabcitest/GitlabCITest/bin/Debug
total 32
drwxr-xr-x. 3 root root 4096 Oct 11 06:57 .
drwxr-xr-x. 3 root root 4096 Oct 11 06:57 ..
-rw-r--r--. 1 root root 3929 Oct 11 06:57 GitlabCITest.1.0.0.nupkg
drwxr-xr-x. 2 root root 4096 Oct 11 06:57 netcoreapp2.1
$ dotnet nuget push --force-english-output /builds/test/gitlabcitest/GitlabCITest/bin/Debug/*.nupkg -s MyCustomNugetServerAddress -k MyApiKey
info : Pushing GitlabCITest.1.0.0.nupkg to 'MyCustomNugetServerAddress'...
info :   PUT MyCustomNugetServerAddress
info :   Forbidden MyCustomNugetServerAddress 651ms
error: Response status code does not indicate success: 403 (Forbidden).

1 个答案:

答案 0 :(得分:0)

都是关于密码字符的,我有一个';'在我的apikey中,所以很复杂。如果您在apikey中有特殊字符,只需在apikey的末尾添加'字符即可。 'apikey'