Class: Gitlab::Ci::Config::Normalizer

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/config/normalizer.rb,
lib/gitlab/ci/config/normalizer/factory.rb,
lib/gitlab/ci/config/normalizer/matrix_strategy.rb,
lib/gitlab/ci/config/normalizer/number_strategy.rb

Defined Under Namespace

Classes: Factory, MatrixStrategy, NumberStrategy

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(jobs_config) ⇒ Normalizer

Returns a new instance of Normalizer.


9
10
11
# File 'lib/gitlab/ci/config/normalizer.rb', line 9

def initialize(jobs_config)
  @jobs_config = jobs_config
end

Instance Method Details

#normalize_jobsObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gitlab/ci/config/normalizer.rb', line 13

def normalize_jobs
  return {} unless @jobs_config
  return @jobs_config if parallelized_jobs.empty?

  expand_parallelize_jobs do |job_name, config|
    if config[:dependencies]
      config[:dependencies] = expand_names(config[:dependencies])
    end

    if job_needs = config.dig(:needs, :job)
      config[:needs][:job] = expand_needs(job_needs)
    end

    config
  end
end