LoginSignup
1
0

More than 5 years have passed since last update.

Gitlab CI でタグ切ったときに走らせたパイプラインから保護した変数が見えなかった

Posted at

概要

以下のような.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.
→ 保護された変数は「保護されたブランチ」「保護されたタグ」から実行されたパイプラインでのみ利用できる

Protected Tagsの設定仕方

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0