summaryrefslogtreecommitdiff
path: root/lib/quality/helm_client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/quality/helm_client.rb')
-rw-r--r--lib/quality/helm_client.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/quality/helm_client.rb b/lib/quality/helm_client.rb
index cf1f03b35b5..a5852988758 100644
--- a/lib/quality/helm_client.rb
+++ b/lib/quality/helm_client.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'time'
-require_relative '../gitlab/popen' unless defined?(Gitlab::Popen)
+require "time"
+require_relative "../gitlab/popen" unless defined?(Gitlab::Popen)
module Quality
class HelmClient
@@ -11,7 +11,7 @@ module Quality
RELEASE_JSON_ATTRIBUTES = %w[Name Revision Updated Status Chart AppVersion Namespace].freeze
- Release = Struct.new(:name, :revision, :last_update, :status, :chart, :app_version, :namespace) do
+ Release = Struct.new(:name, :revision, :last_update, :status, :chart, :app_version, :namespace) {
def revision
@revision ||= self[:revision].to_i
end
@@ -19,7 +19,7 @@ module Quality
def last_update
@last_update ||= Time.parse(self[:last_update])
end
- end
+ }
# A single page of data and the corresponding page number.
Page = Struct.new(:releases, :number)
@@ -34,17 +34,17 @@ module Quality
def delete(release_name:)
run_command([
- 'delete',
+ "delete",
%(--tiller-namespace "#{namespace}"),
- '--purge',
- release_name
+ "--purge",
+ release_name,
])
end
private
def run_command(command)
- final_command = ['helm', *command].join(' ')
+ final_command = ["helm", *command].join(" ")
puts "Running command: `#{final_command}`" # rubocop:disable Rails/Output
result = Gitlab::Popen.popen_with_detail([final_command])
@@ -58,18 +58,18 @@ module Quality
def raw_releases(args = [])
command = [
- 'list',
+ "list",
%(--namespace "#{namespace}"),
%(--tiller-namespace "#{namespace}" --output json),
- *args
+ *args,
]
json = JSON.parse(run_command(command))
- releases = json['Releases'].map do |json_release|
+ releases = json["Releases"].map { |json_release|
Release.new(*json_release.values_at(*RELEASE_JSON_ATTRIBUTES))
- end
+ }
- [releases, json['Next']]
+ [releases, json["Next"]]
rescue JSON::ParserError => ex
puts "Ignoring this JSON parsing error: #{ex}" # rubocop:disable Rails/Output
[[], nil]
@@ -84,7 +84,7 @@ module Quality
return to_enum(__method__, args) unless block_given?
page = 1
- offset = ''
+ offset = ""
loop do
final_args = args.dup