停止gitlab runner以不删除目录

PHA*_*PHA 7 gitlab gitlab-ci gitlab-ci-runner

我有一个在构建期间生成的目录,不应该在下一个版本中删除它.我试图在.gitlab-ci.yml中使用缓存保留目录:

cache:
  key: "$CI_BUILD_REF_NAME"
  untracked: true
  paths:
    - target_directory/
build-runner1:
  stage: build
  script:
    - ./build-platform.sh target_directory
Run Code Online (Sandbox Code Playgroud)

在第一个构建中,生成了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
Run Code Online (Sandbox Code Playgroud)

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

Ala*_*ALI 5

您需要的是使用工作工件

工件是作业成功完成后附加到作业的文件和目录列表。

.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
Run Code Online (Sandbox Code Playgroud)

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

笔记