Skip to content

Commit 4a95da2

Browse files
committed
match repo url by prefix
1 parent 4a532ac commit 4a95da2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
helmsnap (1.2.1)
4+
helmsnap (1.2.2)
55
colorize
66

77
GEM

lib/helmsnap/config.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
class Helmsnap::Config
4-
Credentials = Struct.new(:username, :password)
4+
Credentials = Struct.new(:repo, :username, :password)
55

66
attr_reader :envs, :snapshots_path, :credentials
77

@@ -34,8 +34,8 @@ def parse_snaphots_path(yaml)
3434
end
3535

3636
def parse_credentials(yaml)
37-
yaml.fetch("credentials", []).each_with_object({}) do |obj, credentials|
38-
credentials[obj["repo"]] = Credentials.new(obj["username"], obj["password"])
37+
yaml.fetch("credentials", []).map do |obj|
38+
Credentials.new(obj["repo"], obj["username"], obj["password"])
3939
end
4040
end
4141
end

lib/helmsnap/setup_dependencies.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def setup!(chart_path)
4444
dep_list.scan(%r{(https?://.+?)\s}) do |dep_path|
4545
url = dep_path.first
4646

47-
if (credentials = config.credentials[url])
47+
if (credentials = config.credentials.find { |x| url.start_with?(x.repo) })
4848
extra_args = ["--username", credentials.username, "--password", credentials.password]
4949
end
5050

lib/helmsnap/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Helmsnap
4-
VERSION = "1.2.1"
4+
VERSION = "1.2.2"
55
end

0 commit comments

Comments
 (0)