diff options
Diffstat (limited to 'app/models/ci/stage.rb')
-rw-r--r-- | app/models/ci/stage.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index d035eda6df5..ca74c91b062 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -8,10 +8,11 @@ module Ci delegate :project, to: :pipeline - def initialize(pipeline, name:, status: nil) + def initialize(pipeline, name:, status: nil, warnings: nil) @pipeline = pipeline @name = name @status = status + @warnings = warnings end def to_param @@ -39,5 +40,17 @@ module Ci def builds @builds ||= pipeline.builds.where(stage: name) end + + def success? + status.to_s == 'success' + end + + def has_warnings? + if @warnings.nil? + statuses.latest.failed_but_allowed.any? + else + @warnings + end + end end end |