summaryrefslogtreecommitdiff
path: root/lib/gitlab/badge/pipeline/status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/badge/pipeline/status.rb')
-rw-r--r--lib/gitlab/badge/pipeline/status.rb48
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/gitlab/badge/pipeline/status.rb b/lib/gitlab/badge/pipeline/status.rb
deleted file mode 100644
index f061ba22688..00000000000
--- a/lib/gitlab/badge/pipeline/status.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Badge
- module Pipeline
- ##
- # Pipeline status badge
- #
- class Status < Badge::Base
- attr_reader :project, :ref, :customization
-
- 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]
- }
-
- @sha = @project.commit(@ref).try(:sha)
- end
-
- def entity
- 'pipeline'
- end
-
- # rubocop: disable CodeReuse/ActiveRecord
- def status
- pipelines = @project.ci_pipelines
- .where(sha: @sha)
-
- relation = @ignore_skipped ? pipelines.without_statuses([:skipped]) : pipelines
- relation.latest_status(@ref) || 'unknown'
- end
- # rubocop: enable CodeReuse/ActiveRecord
-
- def metadata
- @metadata ||= Pipeline::Metadata.new(self)
- end
-
- def template
- @template ||= Pipeline::Template.new(self)
- end
- end
- end
- end
-end