From a10f4cef153c2c32c65b2194574bf5760358cf68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 29 Oct 2020 23:57:42 +0100 Subject: [PATCH 1/4] Remove filename restrictions See: #119 --- helm-git-plugin.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/helm-git-plugin.sh b/helm-git-plugin.sh index 6dcdd727..a41dc5fb 100755 --- a/helm-git-plugin.sh +++ b/helm-git-plugin.sh @@ -187,13 +187,6 @@ main() { readonly helm_repo_uri="git+$git_repo@$git_path?ref=$git_ref&sparse=$git_sparse" debug "helm_repo_uri: $helm_repo_uri" - case "$helm_file" in - index.yaml) ;; - *.tgz) ;; - *) error "Target file name has to be either 'index.yaml' or a tgz release" ;; - esac - - # Setup cleanup trap cleanup() { rm -rf "$git_root_path" \ From 5c7964798b5cd778e88be5d242ebc0098222e780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 1 Nov 2020 14:01:59 +0100 Subject: [PATCH 2/4] Additional fixed for helm value files --- helm-git-plugin.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/helm-git-plugin.sh b/helm-git-plugin.sh index a41dc5fb..78d6d1c3 100755 --- a/helm-git-plugin.sh +++ b/helm-git-plugin.sh @@ -199,6 +199,16 @@ main() { readonly git_sub_path=$(path_join "$git_root_path" "$git_path") git_checkout "$git_sparse" "$git_root_path" "$git_repo" "$git_ref" "$git_path" || error "Error while git_sparse_checkout" + + case "$helm_file" in + index.yaml) ;; + *.tgz) ;; + *) + # value files + cat "$git_path/$helm_file" + return + ;; + esac readonly helm_target_path="$(mktemp -d "$TMPDIR/helm-git.XXXXXX")" readonly helm_target_file="$(path_join "$helm_target_path" "$helm_file")" From e363fc611bd1f64bc517170588267f271ada9503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 1 Nov 2020 19:22:16 +0100 Subject: [PATCH 3/4] Add test case for values --- tests/05-helm-cli.bats | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/05-helm-cli.bats b/tests/05-helm-cli.bats index 5f4ca144..a3c3d6f4 100644 --- a/tests/05-helm-cli.bats +++ b/tests/05-helm-cli.bats @@ -58,3 +58,15 @@ load 'test-helper' run grep cert-manager-v0.5.2 "$HELM_HOME/repository/repositories.yaml" [ -n "$output" ] } + +@test "helm_cli template example-chart + values" { + run helm_init "$HELM_HOME" + [ $status = 0 ] + run helm plugin install "$HELM_GIT_DIRNAME" + [ $status = 0 ] + run helm template \ + --repo "git+https://github.com/aslafy-z/helm-git@tests/fixtures/example-chart?ref=master" \ + example-chart \ + -f "git+https://github.com/aslafy-z/helm-git@tests/fixtures/example-chart/values.yaml?ref=master" + [ $status = 0 ] +} From 345cc81692d126e4d116c8309cb48da52e5eb49b Mon Sep 17 00:00:00 2001 From: Julien Bouyoud Date: Thu, 12 Nov 2020 08:11:44 +0100 Subject: [PATCH 4/4] tests: fixup non existing '--repo' on helm 2 --- tests/03-cli.bats | 9 +++++++++ tests/05-helm-cli.bats | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/03-cli.bats b/tests/03-cli.bats index 467992b0..e825dd64 100644 --- a/tests/03-cli.bats +++ b/tests/03-cli.bats @@ -20,3 +20,12 @@ load 'test-helper' run stat "$HELM_GIT_OUTPUT/cert-manager-v0.5.2.tgz" [ $status = 0 ] } + +@test "fetch tests/fixtures/example-chart/values.yaml" { + run helm_init "$HELM_HOME" + url="git+https://github.com/aslafy-z/helm-git@tests/fixtures/example-chart/values.yaml?ref=master" + $HELM_GIT_DIRNAME/helm-git "" "" "" "$url" 2>/dev/null > "$HELM_GIT_OUTPUT/values.yaml" + [ $? = 0 ] + run stat "$HELM_GIT_OUTPUT/values.yaml" + [ $status = 0 ] +} diff --git a/tests/05-helm-cli.bats b/tests/05-helm-cli.bats index a3c3d6f4..5f4ca144 100644 --- a/tests/05-helm-cli.bats +++ b/tests/05-helm-cli.bats @@ -58,15 +58,3 @@ load 'test-helper' run grep cert-manager-v0.5.2 "$HELM_HOME/repository/repositories.yaml" [ -n "$output" ] } - -@test "helm_cli template example-chart + values" { - run helm_init "$HELM_HOME" - [ $status = 0 ] - run helm plugin install "$HELM_GIT_DIRNAME" - [ $status = 0 ] - run helm template \ - --repo "git+https://github.com/aslafy-z/helm-git@tests/fixtures/example-chart?ref=master" \ - example-chart \ - -f "git+https://github.com/aslafy-z/helm-git@tests/fixtures/example-chart/values.yaml?ref=master" - [ $status = 0 ] -}