BigW Consortium Gitlab

generic_commit_status.rb 548 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 14 15 16 17 18
  # GitHub compatible API
  alias_attribute :context, :name

  def set_default_values
    self.context ||= 'default'
    self.stage ||= 'external'
  end

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

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