Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/badge/pipeline')
-rw-r--r--lib/gitlab/badge/pipeline/status.rb7
-rw-r--r--lib/gitlab/badge/pipeline/template.rb4
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/gitlab/badge/pipeline/status.rb b/lib/gitlab/badge/pipeline/status.rb
index 17f179f027d..f061ba22688 100644
--- a/lib/gitlab/badge/pipeline/status.rb
+++ b/lib/gitlab/badge/pipeline/status.rb
@@ -12,6 +12,7 @@ module Gitlab
def initialize(project, ref, opts: {})
@project = project
@ref = ref
+ @ignore_skipped = Gitlab::Utils.to_boolean(opts[:ignore_skipped], default: false)
@customization = {
key_width: opts[:key_width].to_i,
key_text: opts[:key_text]
@@ -26,9 +27,11 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def status
- @project.ci_pipelines
+ pipelines = @project.ci_pipelines
.where(sha: @sha)
- .latest_status(@ref) || 'unknown'
+
+ relation = @ignore_skipped ? pipelines.without_statuses([:skipped]) : pipelines
+ relation.latest_status(@ref) || 'unknown'
end
# rubocop: enable CodeReuse/ActiveRecord
diff --git a/lib/gitlab/badge/pipeline/template.rb b/lib/gitlab/badge/pipeline/template.rb
index 781897fab4b..af8e318395b 100644
--- a/lib/gitlab/badge/pipeline/template.rb
+++ b/lib/gitlab/badge/pipeline/template.rb
@@ -29,7 +29,7 @@ module Gitlab
end
def key_text
- if @key_text && @key_text.size <= MAX_KEY_SIZE
+ if @key_text && @key_text.size <= MAX_KEY_TEXT_SIZE
@key_text
else
@entity.to_s
@@ -41,7 +41,7 @@ module Gitlab
end
def key_width
- if @key_width && @key_width.between?(1, MAX_KEY_SIZE)
+ if @key_width && @key_width.between?(1, MAX_KEY_WIDTH)
@key_width
else
62