Add Ci::Status::Stage
This commit is contained in:
parent
2f972ad47b
commit
d47aef58cd
|
@ -6,6 +6,8 @@ module Ci
|
||||||
|
|
||||||
attr_reader :pipeline, :name
|
attr_reader :pipeline, :name
|
||||||
|
|
||||||
|
delegate :project, to: :pipeline
|
||||||
|
|
||||||
def initialize(pipeline, name: name, status: nil)
|
def initialize(pipeline, name: name, status: nil)
|
||||||
@pipeline, @name, @status = pipeline, name, status
|
@pipeline, @name, @status = pipeline, name, status
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
module Gitlab
|
||||||
|
module Ci
|
||||||
|
module Status
|
||||||
|
module Stage
|
||||||
|
module Common
|
||||||
|
def has_details?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def details_path
|
||||||
|
namespace_project_pipeline_path(@subject.project.namespace,
|
||||||
|
@subject.project,
|
||||||
|
@subject,
|
||||||
|
anchor: subject.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def has_action?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,39 @@
|
||||||
|
module Gitlab
|
||||||
|
module Ci
|
||||||
|
module Status
|
||||||
|
module Stage
|
||||||
|
class Factory
|
||||||
|
EXTENDED_STATUSES = []
|
||||||
|
|
||||||
|
def initialize(stage)
|
||||||
|
@stage = stage
|
||||||
|
@status = stage.status || :created
|
||||||
|
end
|
||||||
|
|
||||||
|
def fabricate!
|
||||||
|
if extended_status
|
||||||
|
extended_status.new(core_status)
|
||||||
|
else
|
||||||
|
core_status
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def core_status
|
||||||
|
Gitlab::Ci::Status
|
||||||
|
.const_get(@status.capitalize)
|
||||||
|
.new(@stage)
|
||||||
|
.extend(Status::Pipeline::Common)
|
||||||
|
end
|
||||||
|
|
||||||
|
def extended_status
|
||||||
|
@extended ||= EXTENDED_STATUSES.find do |status|
|
||||||
|
status.matches?(@stage)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue