簡體   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