Skip to content

Commit

Permalink
fix: parsing of array values
Browse files Browse the repository at this point in the history
  • Loading branch information
ABWassim committed Nov 16, 2023
1 parent 5f87e40 commit 6a36fd4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/commands/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ helm_wrapper() {
_literal=""
fi

opt_prefix="${literal%%=*}="
opt_prefix="${literal%%=*}"

if [ "$opt_prefix" != "" ]; then
opt_prefix="${opt_prefix}="
fi

literal="${literal#*=}"

# Force secret backend
Expand Down
Empty file added tests/http.yaml
Empty file.
26 changes: 26 additions & 0 deletions tests/unit/template.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2136,3 +2136,29 @@ key2: value" 2>&1
assert_success
assert_file_not_exists "${VALUES_PATH}.dec"
}

@test "template: helm template w/ chart + --set imagePullSecrets={fr,en,de,zh,ko}" {
create_chart "${TEST_TEMP_DIR}"

run "${HELM_BIN}" secrets template --set "imagePullSecrets={fr,en,de,zh,ko}" "${TEST_TEMP_DIR}/chart" 2>&1

assert_output --partial "- fr"
assert_output --partial "- en"
assert_output --partial "- de"
assert_output --partial "- zh"
assert_output --partial "- ko"
assert_success
}

@test "template: helm template w/ chart + --set imagePullSecrets={fr,en,de,zh,ko} with quoted values" {
create_chart "${TEST_TEMP_DIR}"

run "${HELM_BIN}" secrets template --set "imagePullSecrets={"fr","en","de","zh","ko"}" "${TEST_TEMP_DIR}/chart" 2>&1

assert_output --partial "- fr"
assert_output --partial "- en"
assert_output --partial "- de"
assert_output --partial "- zh"
assert_output --partial "- ko"
assert_success
}

0 comments on commit 6a36fd4

Please sign in to comment.