目的:在job的script中獲取標籤的值,方便後面作業
.gitlab-ci.yml檔案如下
# 定義 stages stages: - test test_nginx: stage: test tags: - test # only: # refs: # - /^aws/ rules: - if: $CI_COMMIT_TAG =~ /^aws/ script: - echo $CI_COMMIT_TAG - git diff --name-only HEAD HEAD~1 | grep -q "1.txt" && echo "檔案已更改" || echo "檔案未更改"