Unify normalized data columns logic in Ci::JobDefinition

What does this MR do and why?

  • It defines an SSOT for data columns that are extracted from the config (NORMALIZED_DATA_COLUMNS)
  • Refactored the Ci::JobDefinition.fabricate method to unify the logic for such columns that will be added in the future

References

Resolves #566216 (closed)

How to set up and validate locally


# with interruptible: false
pipeline = ::Ci::Pipeline.first
config = { yaml_variables: nil, interruptible: false }


definition = ::Ci::JobDefinition.fabricate(
  config: config,
  project_id: pipeline.project_id,
  partition_id: pipeline.partition_id
)

job_definition = ::Gitlab::Ci::JobDefinitions::FindOrCreate.new(
  pipeline, definitions: [definition]
).execute.first

raise Exception unless job_definition.interruptible == false



# with interruptible: true

config = { yaml_variables: nil, interruptible: true }

definition = ::Ci::JobDefinition.fabricate(
  config: config,
  project_id: pipeline.project_id,
  partition_id: pipeline.partition_id
)

job_definition = ::Gitlab::Ci::JobDefinitions::FindOrCreate.new(
  pipeline, definitions: [definition]
).execute.first

raise Exception unless job_definition.interruptible == true


# with no interruptible value in config (sets column default - false)

pipeline = ::Ci::Pipeline.second
config = { yaml_variables: nil }


definition = ::Ci::JobDefinition.fabricate(
  config: config,
  project_id: pipeline.project_id,
  partition_id: pipeline.partition_id
)

job_definition = ::Gitlab::Ci::JobDefinitions::FindOrCreate.new(
  pipeline, definitions: [definition]
).execute.first

raise Exception unless job_definition.interruptible == false

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Narendran

Merge request reports

Loading