Class: Gitlab::Ci::Variables::Builder::Pipeline
- Inherits:
-
Object
- Object
- Gitlab::Ci::Variables::Builder::Pipeline
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/variables/builder/pipeline.rb
Instance Method Summary collapse
-
#initialize(pipeline) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #predefined_variables ⇒ Object
Constructor Details
#initialize(pipeline) ⇒ Pipeline
Returns a new instance of Pipeline.
10 11 12 |
# File 'lib/gitlab/ci/variables/builder/pipeline.rb', line 10 def initialize(pipeline) @pipeline = pipeline end |
Instance Method Details
#predefined_variables ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gitlab/ci/variables/builder/pipeline.rb', line 14 def predefined_variables Gitlab::Ci::Variables::Collection.new.tap do |variables| variables.append(key: 'CI_PIPELINE_IID', value: pipeline.iid.to_s) variables.append(key: 'CI_PIPELINE_SOURCE', value: pipeline.source.to_s) variables.append(key: 'CI_PIPELINE_CREATED_AT', value: pipeline.created_at&.iso8601) variables.append(key: 'CI_PIPELINE_NAME', value: pipeline.name) variables.concat(predefined_commit_variables) if pipeline.sha.present? variables.concat(predefined_commit_tag_variables) if pipeline.tag? variables.concat(predefined_merge_request_variables) if pipeline.merge_request? if pipeline.open_merge_requests_refs.any? variables.append(key: 'CI_OPEN_MERGE_REQUESTS', value: pipeline.open_merge_requests_refs.join(',')) end variables.append(key: 'CI_GITLAB_FIPS_MODE', value: 'true') if Gitlab::FIPS.enabled? variables.append(key: 'CI_KUBERNETES_ACTIVE', value: 'true') if pipeline.has_kubernetes_active? variables.append(key: 'CI_DEPLOY_FREEZE', value: 'true') if pipeline.freeze_period? if pipeline.external_pull_request_event? && pipeline.external_pull_request variables.concat(pipeline.external_pull_request.predefined_variables) end end end |