繁体   English   中英

停止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首先删除目录?

您需要的是使用工作工件

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

.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

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

注意

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM