summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline/chain/helpers.rb
blob: 02d81286f21fb107878fd688cabb6575ade21b0f (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
module Gitlab
  module Ci
    module Pipeline
      module Chain
        module Helpers
          def branch_exists?
            return @is_branch if defined?(@is_branch)

            @is_branch = project.repository.branch_exists?(pipeline.ref)
          end

          def tag_exists?
            return @is_tag if defined?(@is_tag)

            @is_tag = project.repository.tag_exists?(pipeline.ref)
          end

          def error(message)
            pipeline.errors.add(:base, message)
          end
        end
      end
    end
  end
end