GitLab Runner 在“dotnet restore”或“dotnet test”后停止
GitLab Runner stopping after `dotnet restore` or `dotnet test`
我是 CI 的新手,并尝试将以下 yaml 添加到我们的项目中。
图片:microsoft/dotnet:最新
stages:
- test
test:
stage: test
before_script:
- 'echo Stage - Test started'
- 'dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools'
script:
- 'cd "./My Project"'
- 'dotnet test --settings:./Settings/CodeCoverage.runsettings --collect:"XPlat Code Coverage"'
- './tools/reportgenerator "-reports:./Tests/*/TestResults/*/coverage.cobertura.xml" "-targetdir:Reports_Coverage" -reportTypes:TextSummary'
- 'cat ./Reports_Coverage/Summary.txt'
after_script:
- 'echo Stage - Test finished'
在作业中我得到以下输出:
Running with gitlab-runner 13.7.0 (943fc252) on ***
Resolving secrets
Preparing the "kubernetes" executor
Using Kubernetes namespace: gitlab-pipeline
Using Kubernetes executor with image microsoft/dotnet:latest ...
Preparing environment
Running on*** via ***...
Getting source from Git repository
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/***/.git/
Created fresh repository.
Checking out 07e98444 as ***...
Skipping Git submodules setup
Executing "step_script" stage of the job script
$ echo Stage - Test started
Stage - Test started
$ dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
You can invoke the tool using the following command: reportgenerator
Tool 'dotnet-reportgenerator-globaltool' (version '4.8.4') was successfully installed.
$ cd "./My Project"
$ dotnet test --settings:./Settings/CodeCoverage.runsettings --collect:"XPlat Code Coverage"
Running after_script
Running after script...
$ echo Stage - Test finished
Stage - Test finished
Cleaning up file based variables
ERROR: Job failed: command terminated with exit code 1
我稍微修改了一下,意识到这个缩小的 yaml 也失败了:
image: microsoft/dotnet:latest
stages:
- test
test:
stage: test
before_script:
- 'cd "./My Project"'
- 'dotnet restore'
script:
- 'dotnet test --no-restore'
这会生成一个相等的输出,只是它在 dotnet restore
处停止。
老实说,我不知道该怎么做,因为这是我发现的测试的最小化版本。
我是不是把项目搞砸了,还是 GitLab Runner 本身有问题?
项目版本:.net Core App 3.1
不是真正的解决方案,但我发现了这背后的问题。您可以设置 dotnet test
命令 (documentation) 的详细级别。这样做时,我发现您显然不能 运行 基于 Linux 的 GitLab Runner 中的 WPF 项目。
我是 CI 的新手,并尝试将以下 yaml 添加到我们的项目中。
图片:microsoft/dotnet:最新
stages:
- test
test:
stage: test
before_script:
- 'echo Stage - Test started'
- 'dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools'
script:
- 'cd "./My Project"'
- 'dotnet test --settings:./Settings/CodeCoverage.runsettings --collect:"XPlat Code Coverage"'
- './tools/reportgenerator "-reports:./Tests/*/TestResults/*/coverage.cobertura.xml" "-targetdir:Reports_Coverage" -reportTypes:TextSummary'
- 'cat ./Reports_Coverage/Summary.txt'
after_script:
- 'echo Stage - Test finished'
在作业中我得到以下输出:
Running with gitlab-runner 13.7.0 (943fc252) on ***
Resolving secrets
Preparing the "kubernetes" executor
Using Kubernetes namespace: gitlab-pipeline
Using Kubernetes executor with image microsoft/dotnet:latest ...
Preparing environment
Running on*** via ***...
Getting source from Git repository
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/***/.git/
Created fresh repository.
Checking out 07e98444 as ***...
Skipping Git submodules setup
Executing "step_script" stage of the job script
$ echo Stage - Test started
Stage - Test started
$ dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
You can invoke the tool using the following command: reportgenerator
Tool 'dotnet-reportgenerator-globaltool' (version '4.8.4') was successfully installed.
$ cd "./My Project"
$ dotnet test --settings:./Settings/CodeCoverage.runsettings --collect:"XPlat Code Coverage"
Running after_script
Running after script...
$ echo Stage - Test finished
Stage - Test finished
Cleaning up file based variables
ERROR: Job failed: command terminated with exit code 1
我稍微修改了一下,意识到这个缩小的 yaml 也失败了:
image: microsoft/dotnet:latest
stages:
- test
test:
stage: test
before_script:
- 'cd "./My Project"'
- 'dotnet restore'
script:
- 'dotnet test --no-restore'
这会生成一个相等的输出,只是它在 dotnet restore
处停止。
老实说,我不知道该怎么做,因为这是我发现的测试的最小化版本。
我是不是把项目搞砸了,还是 GitLab Runner 本身有问题?
项目版本:.net Core App 3.1
不是真正的解决方案,但我发现了这背后的问题。您可以设置 dotnet test
命令 (documentation) 的详细级别。这样做时,我发现您显然不能 运行 基于 Linux 的 GitLab Runner 中的 WPF 项目。