BigW Consortium Gitlab

generic_commit_status.rb 579 Bytes
Newer Older
1 2 3
class GenericCommitStatus < CommitStatus
  before_validation :set_default_values

4 5 6 7
  validates :target_url, addressable_url: true,
                         length: { maximum: 255 },
                         allow_nil: true

8 9 10 11 12 13
  # GitHub compatible API
  alias_attribute :context, :name

  def set_default_values
    self.context ||= 'default'
    self.stage ||= 'external'
14
    self.stage_idx ||= 1000000
15 16 17 18 19
  end

  def tags
    [:external]
  end
20 21 22 23 24 25

  def detailed_status(current_user)
    Gitlab::Ci::Status::External::Factory
      .new(self, current_user)
      .fabricate!
  end
26
end