summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline/chain/config/content/legacy_repository.rb
blob: fa4a97c68808b98b0ccc7ad3bf7472a208c59fe5 (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
# frozen_string_literal: true

module Gitlab
  module Ci
    module Pipeline
      module Chain
        module Config
          class Content
            class LegacyRepository < Source
              def content
                strong_memoize(:content) do
                  next unless project
                  next unless @pipeline.sha
                  next unless ci_config_path

                  project.repository.gitlab_ci_yml_for(@pipeline.sha, ci_config_path)
                rescue GRPC::NotFound, GRPC::Internal
                  nil
                end
              end

              def source
                :repository_source
              end
            end
          end
        end
      end
    end
  end
end