1. 程式人生 > 其它 >GitLab CI / CD管道配置參考 .gitlab-ci.yml 檔案定義內容

GitLab CI / CD管道配置參考 .gitlab-ci.yml 檔案定義內容

GitLab CI / CD管道配置參考 .gitlab-ci.yml 檔案定義內容

gitlab 官方參考文件

關鍵詞 描述
script 由Runner執行的Shell指令碼。
image 使用docker映像。也可用:image:name和image:entrypoint。
services 使用docker服務映像。也可用:services:name,services:alias,services:entrypoint,和services:command。
before_script 覆蓋作業之前執行的一組命令。
after_script 覆蓋作業後執行的一組命令。
stages 定義管道中的階段。
stage 定義一個作業階段(預設值:)test。
only 限制建立作業的時間。也可用:only:refs,only:kubernetes,only:variables,和only:changes。
except 限制未建立作業的時間。也可用:except:refs,except:kubernetes,except:variables,和except:changes。
tags 用於選擇Runner的標籤列表。
allow_failure 允許作業失敗。失敗的工作不會影響提交狀態。
when 什麼時候開始工作。也可用:when:manual和when:delayed。
environment 作業部署到的環境的名稱。也可用:environment:name,environment:url,environment:on_stop,和environment:action。
cache 在後續執行之間應快取的檔案列表。也可用:cache:paths,cache:key,cache:untracked,和cache:policy。
artifacts 成功時附加到作業的檔案和目錄列表。也可用:artifacts:paths,artifacts:name,artifacts:untracked,artifacts:when,artifacts:expire_in,artifacts:reports,和artifacts:reports:junit。在GitLab 企業版,這些都是可供選擇:artifacts:reports:codequality,artifacts:reports:sast,artifacts:reports:dependency_scanning,artifacts:reports:container_scanning,artifacts:reports:dast,artifacts:reports:license_management,artifacts:reports:performance和artifacts:reports:metrics。
dependencies 一個作業所依賴的其他作業,以便您可以在它們之間傳遞工件。
coverage 給定作業的程式碼覆蓋率設定。
retry 發生故障時可以自動重試作業的時間和次數。
parallel 多少個作業例項應並行執行。
trigger 定義下游管道觸發器。
include 允許此作業包括外部YAML檔案。也可用:include:local,include:file,include:template,和include:remote。
extends 此作業將要繼承的配置條目。
pages 上載作業結果以用於GitLab頁面。
variables 在作業級別上定義作業變數。

注意: 引數types和type已棄用