Continuous integration GitLab Runner从GitLab启动时无法还原nuget包,但在本地启动时可以还原

Continuous integration GitLab Runner从GitLab启动时无法还原nuget包,但在本地启动时可以还原,continuous-integration,nuget,gitlab,gitlab-ci,gitlab-ci-runner,Continuous Integration,Nuget,Gitlab,Gitlab Ci,Gitlab Ci Runner,我正在尝试使用gitlab CI构建和测试一个.NET项目 我已经下载并安装了最新版本的GitLab runner,并成功地在我们的GitLab实例中注册了它。我创建了以下.gitlab ci.yaml文件: variables: Solution: Performance-Validation-Tool.sln stages: - build - test # - deploy build: stage: build script: - echo "Restori

我正在尝试使用gitlab CI构建和测试一个.NET项目

我已经下载并安装了最新版本的GitLab runner,并成功地在我们的GitLab实例中注册了它。我创建了以下
.gitlab ci.yaml
文件:

variables:
  Solution: Performance-Validation-Tool.sln

stages:
  - build
  - test
#  - deploy

build:
  stage: build
  script:
  - echo "Restoring NuGet packages..."
  - 'C:/nuget/NuGet.exe restore'
  - echo building...
  - 'msbuild.exe "%Solution%"'
  except:
  - tags

test:
  stage: test
  script:
  - echo testing...
  - 'msbuild.exe "%Solution%"'
  - dir /s /b *.Tests.dll | findstr /r Tests\\*\\bin\\ > testcontainers.txt
  - 'for /f %%f in (testcontainers.txt) do mstest.exe /testcontainer:"%%f"'
  except:
  - tags
重要的部分是构建操作

如果从Gitlab本身运行构建,则所有nugget包都会出现以下错误:

WARNING: Unable to find version '3.5.0' of package 'NUnit.Console'.

  C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache: Package 'NUnit.Console.3.5.0' is not found on source 'C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache'.

  https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json.

  An error occurred while sending the request.

  The remote name could not be resolved: 'api.nuget.org'
但是,如果在本地运行以下命令:

C:\GitlabRunner\gitlab-ci-multi-runner-windows-amd64.exe exec shell build
一切都很完美

我已经为gitlab runner和nugget.exe创建了防火墙例外(我下载并安装了nugget.exe的最新版本)

gitlab runner服务与我运行manual exec命令时使用的帐户相同

我对gitlab触发的构建和手动exec命令使用了相同的nugget.exe

我们在一个公司代理后面,没有HTTP\U代理环境变量集。代理在“internet选项”中配置。我确实尝试为nugget.exe定义HTTP_代理设置,但后来在读取到nugget.exe默认使用系统代理后将其删除


提前感谢您的帮助

我碰巧查看了服务列表中的服务,注意到尽管我已明确指定了该服务的用户,但它是使用“本地系统”帐户创建的,我认为该帐户缺少代理设置。该服务已更正,现在已正确构建