Commit b57ab995 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'fix_spelling_rollout_status_status_map' into 'master'

Refactor away STATUS_MAP

See merge request gitlab-org/gitlab-ee!14054
parents 45295b94 a755d4ca
......@@ -10,14 +10,6 @@ module Gitlab
class RolloutStatus
attr_reader :deployments, :instances, :completion, :status
STATUS_MAP = {
running: 'running',
failed: 'failed',
unkonw: 'unknown',
succeeded: 'succeeded',
pending: 'pending'
}.freeze
def complete?
completion == 100
end
......@@ -60,7 +52,8 @@ module Gitlab
if @instances.empty?
100
else
finished = @instances.select { |instance| instance[:status] == STATUS_MAP[:running] }.count
# We downcase the pod status in Gitlab::Kubernetes::Deployment#deployment_instance
finished = @instances.count { |instance| instance[:status] == Gitlab::Kubernetes::Pod::RUNNING.downcase }
(finished / @instances.count.to_f * 100).to_i
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment