summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/framework/icons.scss1
-rw-r--r--app/assets/stylesheets/pages/status.scss3
-rw-r--r--app/models/ci/pipeline.rb15
-rw-r--r--app/models/ci/stage.rb15
-rw-r--r--app/models/concerns/has_status.rb1
5 files changed, 28 insertions, 7 deletions
diff --git a/app/assets/stylesheets/framework/icons.scss b/app/assets/stylesheets/framework/icons.scss
index dccf5177e35..868f28cd356 100644
--- a/app/assets/stylesheets/framework/icons.scss
+++ b/app/assets/stylesheets/framework/icons.scss
@@ -15,6 +15,7 @@
}
.ci-status-icon-pending,
+.ci-status-icon-failed_with_warnings,
.ci-status-icon-success_with_warnings {
color: $gl-warning;
diff --git a/app/assets/stylesheets/pages/status.scss b/app/assets/stylesheets/pages/status.scss
index f19275770be..6f31d4ed789 100644
--- a/app/assets/stylesheets/pages/status.scss
+++ b/app/assets/stylesheets/pages/status.scss
@@ -19,7 +19,8 @@
overflow: visible;
}
- &.ci-failed {
+ &.ci-failed,
+ &.ci-failed_with_warnings {
color: $gl-danger;
border-color: $gl-danger;
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 2a97e8bae4a..fab8497ec7d 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -128,16 +128,21 @@ module Ci
end
def stages
+ # TODO, this needs refactoring, see gitlab-ce#26481.
+
+ stages_query = statuses
+ .group('stage').select(:stage).order('max(stage_idx)')
+
status_sql = statuses.latest.where('stage=sg.stage').status_sql
- stages_query = statuses.group('stage').select(:stage)
- .order('max(stage_idx)')
+ warnings_sql = statuses.latest.select('COUNT(*) > 0')
+ .where('stage=sg.stage').failed_but_allowed.to_sql
- stages_with_statuses = CommitStatus.from(stages_query, :sg).
- pluck('sg.stage', status_sql)
+ stages_with_statuses = CommitStatus.from(stages_query, :sg)
+ .pluck('sg.stage', status_sql, "(#{warnings_sql})")
stages_with_statuses.map do |stage|
- Ci::Stage.new(self, name: stage.first, status: stage.last)
+ Ci::Stage.new(self, Hash[%i[name status warnings].zip(stage)])
end
end
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
diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb
index 90432fc4050..431c0354969 100644
--- a/app/models/concerns/has_status.rb
+++ b/app/models/concerns/has_status.rb
@@ -1,6 +1,7 @@
module HasStatus
extend ActiveSupport::Concern
+ DEFAULT_STATUS = 'created'
AVAILABLE_STATUSES = %w[created pending running success failed canceled skipped]
STARTED_STATUSES = %w[running success failed skipped]
ACTIVE_STATUSES = %w[pending running]