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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-01 18:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-01 18:09:16 +0300
commit18d5458781b21dee4dbb8854c72c064e9bd808ed (patch)
tree73cfc86a9b77398a154ebabebc054b45d4aeb83d /tooling
parenta21091270d45530468f8ac2f4f926fe1b9840b67 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rw-r--r--tooling/lib/tooling/helm3_client.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/tooling/lib/tooling/helm3_client.rb b/tooling/lib/tooling/helm3_client.rb
index d4e7faa802e..9059387351a 100644
--- a/tooling/lib/tooling/helm3_client.rb
+++ b/tooling/lib/tooling/helm3_client.rb
@@ -8,34 +8,32 @@ module Tooling
class Helm3Client
CommandFailedError = Class.new(StandardError)
- attr_reader :namespace
-
RELEASE_JSON_ATTRIBUTES = %w[name revision updated status chart app_version namespace].freeze
PAGINATION_SIZE = 256 # Default helm list pagination size
- Release = Struct.new(:name, :revision, :last_update, :status, :chart, :app_version, :namespace) do
+ Release = Struct.new(:name, :namespace, :revision, :updated, :status, :chart, :app_version, keyword_init: true) do
def revision
@revision ||= self[:revision].to_i
end
def last_update
- @last_update ||= self[:last_update] ? Time.parse(self[:last_update]) : nil
+ @last_update ||= self[:updated] ? Time.parse(self[:updated]) : nil
end
end
# A single page of data and the corresponding page number.
Page = Struct.new(:releases, :number)
- def initialize(namespace:)
- @namespace = namespace
- end
-
def releases(args: [])
each_release(args)
end
- def delete(release_name:)
- run_command(['uninstall', release_name])
+ def delete(release_name:, namespace: nil)
+ release_name = Array(release_name)
+
+ release_name.each do |release|
+ run_command(['uninstall', '--namespace', (namespace || release), release])
+ end
end
private
@@ -66,7 +64,7 @@ module Tooling
releases = JSON.parse(response) # rubocop:disable Gitlab/Json
releases.map do |release|
- Release.new(*release.values_at(*RELEASE_JSON_ATTRIBUTES))
+ Release.new(release.slice(*RELEASE_JSON_ATTRIBUTES))
end
rescue ::JSON::ParserError => ex
puts "Ignoring this JSON parsing error: #{ex}\n\nResponse was:\n#{response}" # rubocop:disable Rails/Output