helm-wrapper 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/helm-wrapper/shared/chart.rb +2 -12
- data/lib/helm-wrapper/shared/runner.rb +22 -5
- data/lib/helm-wrapper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76acfe4805299ed72c029326ed693127fe8518078eea2d5c81880be17d1823d4
|
4
|
+
data.tar.gz: 6355e496234578a2f414cf8873b2ecfff6d0aa710a4045a3741e940e1996ada8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec82adad9abe9ad074f6f60fc4ed5711e9f08a7c92258b1b6e71fcf6da491c3a9a0f211796d7ccab3d2f30c027ad0cfdad06955233547bb788faef0e81172f5
|
7
|
+
data.tar.gz: 0b1299e87f67e83c2a7289049a9222b7a269739fd50b8fc9e18e94f818076dd9c857607507911b690feebae91e6a7fe0c7a5a3408883361705ec6f61201c4d83
|
@@ -77,23 +77,13 @@ module HelmWrapper
|
|
77
77
|
logger.fatal("Chart repo: #{hash["name"]} username must be a string!") unless repo["username"].kind_of?(String)
|
78
78
|
logger.fatal("Chart repo: #{hash["name"]} username must not be blank!") if repo["username"].strip.empty?
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
logger.fatal("Chart repo: #{hash["name"]} username attribute must refer to a valid environment variable that holds the actual repository username!") unless ENV.key?(repo_username)
|
83
|
-
logger.fatal("Environment variable holding the username for chart repo: #{hash["name"]} is blank!") if ENV[repo_username].strip.empty?
|
84
|
-
|
85
|
-
hash["username"] = ENV[repo_username].strip
|
80
|
+
hash["username"] = repo["username"].strip
|
86
81
|
|
87
82
|
logger.fatal("Chart repo: #{hash["name"]} must have a password attribute if 'username' is set!") unless repo.key?("password")
|
88
83
|
logger.fatal("Chart repo: #{hash["name"]} password must be a string!") unless repo["password"].kind_of?(String)
|
89
84
|
logger.fatal("Chart repo: #{hash["name"]} password must not be blank!") if repo["password"].strip.empty?
|
90
85
|
|
91
|
-
|
92
|
-
|
93
|
-
logger.fatal("Chart repo: #{hash["name"]} password attribute must refer to a valid environment variable that holds the actual repository password!") unless ENV.key?(repo_password)
|
94
|
-
logger.fatal("Environment variable holding the password for chart repo: #{hash["name"]} is blank!") if ENV[repo_password].strip.empty?
|
95
|
-
|
96
|
-
hash["password"] = ENV[repo_password].strip
|
86
|
+
hash["password"] = repo["password"].strip
|
97
87
|
else
|
98
88
|
fatal("Chart repo: #{hash["name"]} is an OCI repository therefore must have a username attribute! Public OCI repositories do not need to be declared.") if is_oci
|
99
89
|
hash["username"] = nil
|
@@ -64,28 +64,36 @@ module HelmWrapper
|
|
64
64
|
|
65
65
|
@chart.oci.each_with_index do |oci_repo, oci_index|
|
66
66
|
logger.info("Logging into OCI repository: #{oci_repo["name"]}")
|
67
|
+
|
68
|
+
username = from_environment(variable: oci_repo["username"])
|
69
|
+
password = from_environment(variable: oci_repo["password"])
|
70
|
+
|
67
71
|
@chart.oci_active(active: true, index: oci_index)
|
68
72
|
|
69
73
|
parameters = Array.new
|
70
74
|
parameters.append("login")
|
71
75
|
parameters.append("\"#{oci_repo["url"]}\"")
|
72
|
-
parameters.append("--username=\"#{
|
76
|
+
parameters.append("--username=\"#{username}\"")
|
73
77
|
parameters.append("--password-stdin")
|
74
|
-
logger.fatal("Failed to login to Helm OCI repository: #{oci_repo["name"]}, url: #{oci_repo["url"]}") unless run(action: "registry", parameters: parameters, stdin:
|
78
|
+
logger.fatal("Failed to login to Helm OCI repository: #{oci_repo["name"]}, url: #{oci_repo["url"]}") unless run(action: "registry", parameters: parameters, stdin: password)
|
75
79
|
end
|
76
80
|
|
77
81
|
if @chart.artefact.length > 0 then
|
78
82
|
|
79
83
|
@chart.artefact.each_with_index do |artefact_repo, artefact_index|
|
80
84
|
logger.info("Adding artefact repository: #{artefact_repo["name"]}")
|
85
|
+
|
86
|
+
username = artefact_repo["username"].nil? ? nil : from_environment(variable: artefact_repo["username"])
|
87
|
+
password = artefact_repo["password"].nil? ? nil : from_environment(variable: artefact_repo["password"])
|
88
|
+
|
81
89
|
@chart.artefact_active(active: true, index: artefact_index)
|
82
90
|
|
83
91
|
parameters = Array.new
|
84
92
|
parameters.append("add")
|
85
93
|
parameters.append("\"#{artefact_repo["name"]}\"")
|
86
94
|
parameters.append("\"#{artefact_repo["url"]}\"")
|
87
|
-
parameters.append("--username=\"#{
|
88
|
-
parameters.append("--password=\"#{
|
95
|
+
parameters.append("--username=\"#{username}\"") unless username.nil?
|
96
|
+
parameters.append("--password=\"#{password}\"") unless password.nil?
|
89
97
|
parameters.append("--force-update") if force
|
90
98
|
logger.fatal("Failed to add Helm repository: #{artefact_repo["name"]}, url: #{artefact_repo["url"]}") unless run(action: "repo", parameters: parameters)
|
91
99
|
end
|
@@ -269,7 +277,7 @@ module HelmWrapper
|
|
269
277
|
out, status = Open3.capture2e(cmdline, :stdin_data=>stdin)
|
270
278
|
logger.debug("Helm output:")
|
271
279
|
logger.debug(out)
|
272
|
-
result =
|
280
|
+
result = statrepo_usernameus.success?
|
273
281
|
rescue
|
274
282
|
result = false
|
275
283
|
end
|
@@ -287,6 +295,15 @@ module HelmWrapper
|
|
287
295
|
return result
|
288
296
|
end
|
289
297
|
|
298
|
+
###############################################################################
|
299
|
+
|
300
|
+
def from_environment(variable:)
|
301
|
+
logger.fatal("Environment variable: #{variable} does not exist") unless ENV.key?(variable)
|
302
|
+
logger.fatal("Environment variable: #{variable} is blank!") if ENV[variable].strip.empty?
|
303
|
+
|
304
|
+
return ENV[variable].strip
|
305
|
+
end
|
306
|
+
|
290
307
|
###############################################################################
|
291
308
|
|
292
309
|
end
|
data/lib/helm-wrapper/version.rb
CHANGED