|
|
|
@ -81,9 +81,12 @@ fi
|
|
|
|
if [[ 1 -eq 1 ]]; then
|
|
|
|
if [[ 1 -eq 1 ]]; then
|
|
|
|
>&2 echo -e "# ---\n# TEST: auto-find secrets files"
|
|
|
|
>&2 echo -e "# ---\n# TEST: auto-find secrets files"
|
|
|
|
# SETUP
|
|
|
|
# SETUP
|
|
|
|
_tmp_mock_secrets_filepath='mock_hierarchy/secrets.yaml'
|
|
|
|
_tmp_mock_secrets_filepath_1='mock_hierarchy/one/secrets.yaml'
|
|
|
|
mkdir -p "$(dirname "${_tmp_mock_secrets_filepath}")"
|
|
|
|
mkdir -p "$(dirname "${_tmp_mock_secrets_filepath_1}")"
|
|
|
|
touch "${_tmp_mock_secrets_filepath}"
|
|
|
|
touch "${_tmp_mock_secrets_filepath_1}"
|
|
|
|
|
|
|
|
_tmp_mock_secrets_filepath_2='mock_hierarchy/two/secrets.yaml'
|
|
|
|
|
|
|
|
mkdir -p "$(dirname "${_tmp_mock_secrets_filepath_2}")"
|
|
|
|
|
|
|
|
touch "${_tmp_mock_secrets_filepath_2}"
|
|
|
|
# RUN
|
|
|
|
# RUN
|
|
|
|
# set -x
|
|
|
|
# set -x
|
|
|
|
# suspend strict: check output for errors
|
|
|
|
# suspend strict: check output for errors
|
|
|
|
@ -91,14 +94,17 @@ if [[ 1 -eq 1 ]]; then
|
|
|
|
# move 'set -x' within the sub-shell, otherwise all output dumped to tty
|
|
|
|
# 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'
|
|
|
|
# ... bug: stderr still gets printed, not sure why. E.g. '# RUN: sops updatekeys mock_secrets.yaml'
|
|
|
|
_out="$(set -x; ../bin/update_sops.sh --find_secrets -s "${secrets_file}" 2>&1 )"
|
|
|
|
_out="$(set -x; ../bin/update_sops.sh --find_secrets -s "${secrets_file}" 2>&1 )"
|
|
|
|
|
|
|
|
echo "$_out}"
|
|
|
|
# re-enable strict
|
|
|
|
# re-enable strict
|
|
|
|
set -e
|
|
|
|
set -e
|
|
|
|
set +x
|
|
|
|
set +x
|
|
|
|
grep "${_tmp_mock_secrets_filepath}" <<< "${_out}"
|
|
|
|
grep "${_tmp_mock_secrets_filepath_1}" <<< "${_out}"
|
|
|
|
|
|
|
|
grep "${_tmp_mock_secrets_filepath_2}" <<< "${_out}"
|
|
|
|
grep "${secrets_file}" <<< "${_out}"
|
|
|
|
grep "${secrets_file}" <<< "${_out}"
|
|
|
|
set -e
|
|
|
|
set -e
|
|
|
|
# TEARDOWN
|
|
|
|
# TEARDOWN
|
|
|
|
rm -rf "${_tmp_mock_secrets_filepath}"
|
|
|
|
rm -rf "${_tmp_mock_secrets_filepath_1}"
|
|
|
|
|
|
|
|
rm -rf "${_tmp_mock_secrets_filepath_2}"
|
|
|
|
# enmesh: restore, since this particular one is checked in
|
|
|
|
# enmesh: restore, since this particular one is checked in
|
|
|
|
git checkout "${PWD}/.sops.yaml" > /dev/null 2>&1
|
|
|
|
git checkout "${PWD}/.sops.yaml" > /dev/null 2>&1
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|