summaryrefslogtreecommitdiff
path: root/app/models/generic_commit_status.rb
blob: d4afd8cbe84085d5e61107de693e2e17f93f7a74 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
# == Schema Information
#
# Table name: ci_builds
#
#  id                 :integer          not null, primary key
#  project_id         :integer
#  status             :string
#  finished_at        :datetime
#  trace              :text
#  created_at         :datetime
#  updated_at         :datetime
#  started_at         :datetime
#  runner_id          :integer
#  coverage           :float
#  commit_id          :integer
#  commands           :text
#  job_id             :integer
#  name               :string
#  deploy             :boolean          default(FALSE)
#  options            :text
#  allow_failure      :boolean          default(FALSE), not null
#  stage              :string
#  trigger_request_id :integer
#  stage_idx          :integer
#  tag                :boolean
#  ref                :string
#  user_id            :integer
#  type               :string
#  target_url         :string
#  description        :string
#  artifacts_file     :text
#  gl_project_id      :integer
#  artifacts_metadata :text
#  erased_by_id       :integer
#  erased_at          :datetime
#

class GenericCommitStatus < CommitStatus
  before_validation :set_default_values

  # GitHub compatible API
  alias_attribute :context, :name

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

  def tags
    [:external]
  end
end