停止 gitlab runner 不删除目录

Stop gitlab runner to not remove a directory

我有一个在构建期间生成的目录,不应在下一个构建中删除它。我试图在 .gitlab-ci.yml:

中使用缓存保留目录
cache:
  key: "$CI_BUILD_REF_NAME"
  untracked: true
  paths:
    - target_directory/
build-runner1:
  stage: build
  script:
    - ./build-platform.sh target_directory

在第一个构建中生成了 cache.zip,但对于下一个构建,target_directory 被删除并提取了 cache.zip,这需要很长时间。这是第二次构建的日志:

Running with gitlab-ci-multi-runner 1.11.
  on Runner1
Using Shell executor...
Running on Runner1...
Fetching changes...
Removing target_directory/
HEAD is now at xxxxx Update .gitlab-ci.yml
From xxxx
Checking out xxx as master...
Skipping Git submodules setup
Checking cache for master...
Successfully extracted cache

有没有办法让 gitlab runner 不首先删除目录?

你需要的是使用一个工作工件:

Artifacts is a list of files and directories which are attached to a job after it completes successfully.

.gitlab-ci.yml 文件:

your job:
    before_script:
        - do something
    script:
         - do another thing
         - do something to generate your zip file (example: myFiles.zip)
  artifacts:
    paths:
         - myFiles.zip

作业完成后,如果您访问该作业的特定页面,您会看到有一个用于下载工件存档的按钮。

备注