概要
以下のような.gitlab-ci.yml
で「Environment variables」にて「保護」を選択した変数が「script」内で使用できなかった(ブランクだった)
.gitlab-ci.yml(抜粋)
deploy-production:
stage: deploy
only:
- tags
- triggers
script:
- <略>
結論
「Protected Tags」に対象のタグ名を設定しないと、保護した変数をパイプラインで利用できないため!
→ https://gitlab.com/help/ci/variables/README#protected-variables
Variables could be protected. Whenever a variable is
protected, it would only be securely passed to pipelines running on the
protected branches or protected tags. The other pipelines would not get any
protected variables.
→ 保護された変数は「保護されたブランチ」「保護されたタグ」から実行されたパイプラインでのみ利用できる