From 6a5952bcea6a6f519957bcbf53d87fb7303ab6ad Mon Sep 17 00:00:00 2001 From: LeeW Date: Fri, 7 Mar 2025 14:39:03 +0100 Subject: [PATCH] adds auto-find for secrets files, fix --- bin/update_sops.sh | 3 +-- verify/test.sh | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/update_sops.sh b/bin/update_sops.sh index 98a1eac..b290fc1 100755 --- a/bin/update_sops.sh +++ b/bin/update_sops.sh @@ -185,7 +185,7 @@ function main(){ # locate appropriate sops config if default assumption not found # dev note: '2> /dev/null' to disable debug output sops_config="$(fn_sops_locate_config_in_git_repo 2> /dev/null)" - sops_config_dir="$(basename "${sops_config}")" + sops_config_dir="$(dirname "${sops_config}")" fi # Paths to Secrets Files @@ -195,7 +195,6 @@ function main(){ done fi if [[ "${opt_find_secrets}" -eq 1 ]]; then - found_secrets_file_list="$(find "${sops_config_dir}" -name secrets.yaml)" secrets_file_list+=("$(find "${sops_config_dir}" -name secrets.yaml)") fi # /VALIDATE INPUTS diff --git a/verify/test.sh b/verify/test.sh index d697f7a..b567796 100755 --- a/verify/test.sh +++ b/verify/test.sh @@ -90,7 +90,7 @@ if [[ 1 -eq 1 ]]; then set +e # move 'set -x' within the sub-shell, otherwise all output dumped to tty # ... bug: stderr still gets printed, not sure why. E.g. '# RUN: sops updatekeys mock_secrets.yaml' - _out="$(set -x; ../bin/update_sops.sh -c "${PWD}" --find_secrets "${secrets_file}" 2>&1 )" + _out="$(set -x; ../bin/update_sops.sh --find_secrets -s "${secrets_file}" 2>&1 )" # re-enable strict set -e set +x