summaryrefslogtreecommitdiff
path: root/app/models/concerns/ci/processable.rb
blob: ed0087f34d48fd611a7ed0dd99be359aeefd707d (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
# frozen_string_literal: true

module Ci
  ##
  # This module implements methods that need to be implemented by CI/CD
  # entities that are supposed to go through pipeline processing
  # services.
  #
  #
  module Processable
    extend ActiveSupport::Concern

    included do
      has_many :needs, class_name: 'Ci::BuildNeed', foreign_key: :build_id, inverse_of: :build

      accepts_nested_attributes_for :needs
    end

    def schedulable?
      raise NotImplementedError
    end

    def action?
      raise NotImplementedError
    end

    def when
      read_attribute(:when) || 'on_success'
    end

    def expanded_environment_name
      raise NotImplementedError
    end

    def scoped_variables_hash
      raise NotImplementedError
    end
  end
end