Gitlab-Runner Shell 自动删除文件

Gitlab-Runner Shell auto deletes files

我一直在尝试让 CI 使用 gitlab-运行ner 和 shell 命令行使用 yml。我的测试是 运行 并且没有问题。我遇到的唯一问题是,当测试结束时,测试结果会从目录中删除,我不知道为什么。当测试 运行ning 它存在大约一分钟然后消失。没有显示错误。 gitlab-runner.exe --debug run 也没有给我任何有用的信息。我的代码如下。

stages: 
  - edit
  - play
  - build
  
unit-test: 
  script: C:/"Unity projects"/2019.3.0f6/Editor/Unity.exe -batchmode -projectPath=. -runTests -testPlatform editmode -logFile -testResults "./unit-tests-edit.xml" | Out-Default
  stage: edit
  tags: 
    - Desktop

play-test: 
  script: C:/"Unity projects"/2019.3.0f6/Editor/Unity.exe -batchmode -projectPath=. -runTests -testPlatform editmode -logFile -testResults "./unit-tests-play.xml" | Out-Default
  stage: play
  tags: 
    - Desktop

unity-build: 
  script: C:/"Unity projects"/2019.3.0f6/Editor/Unity.exe -batchmode -logFile -projectPath=. -executeMethod WindowsBuildScript.PerformBuild -quit
  stage: build
  tags: 
    - Desktop

据我了解这段代码应该是正确的。我在自动构建 Unity 项目时遇到了同样的问题。在向我的项目添加更多内容后,它根本不再构建或发生了什么,我不确定发生了什么。有谁知道为什么文件会自动删除自己?有问题的文件是 unit-tests-edit.xml 和 unit-tests-play。我认为如果我能够解决这些问题,构建应该也会正确显示。

那是因为每个作业都有自己的 shell 环境。您需要使用 artifacts 将文件从一个作业传递到另一个作业。

https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html