Welcome to mirror list, hosted at ThFree Co, Russian Federation.

auto_devops.rb « content « config « chain « pipeline « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8d19a73dfc31d54335c8c884aad8f931afafbbee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
39
40
41
42
# frozen_string_literal: true

module Gitlab
  module Ci
    module Pipeline
      module Chain
        module Config
          class Content
            class AutoDevops < Source
              def content
                strong_memoize(:content) do
                  next unless project&.auto_devops_enabled?

                  template = Gitlab::Template::GitlabCiYmlTemplate.find(template_name)
                  YAML.dump('include' => [{ 'template' => template.full_name }])
                end
              end

              def source
                :auto_devops_source
              end

              private

              def template_name
                if beta_enabled?
                  'Beta/Auto-DevOps'
                else
                  'Auto-DevOps'
                end
              end

              def beta_enabled?
                Feature.enabled?(:auto_devops_beta, project, default_enabled: true)
              end
            end
          end
        end
      end
    end
  end
end