From 45bb904a6881e6ae94ea98bccd16b3a1ae3eca27 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 8 Jan 2025 13:28:44 -0500 Subject: [PATCH] --dry-run always overrides destructive operations --- .../housekeeper-artifactory-zitipax.bash | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/zititest/scripts/housekeeper-artifactory-zitipax.bash b/zititest/scripts/housekeeper-artifactory-zitipax.bash index 6c6b125aa..56ae1d78c 100644 --- a/zititest/scripts/housekeeper-artifactory-zitipax.bash +++ b/zititest/scripts/housekeeper-artifactory-zitipax.bash @@ -13,6 +13,9 @@ typeset -A KNOWN_STAGES=( : "${AGE:=30}" # days : "${CI:=0}" # jfrog CLI is interactive and prompts for confirmation by default +: "${DRY_RUN:=0}" +: "${QUIET:=0}" + export CI while (( $# )); do @@ -48,14 +51,23 @@ while (( $# )); do echo "ERROR: invalid stage '${STAGE}', valid stages are ${!KNOWN_STAGES[*]}" >&2 exit 1 done - echo "INFO: stages are ${STAGES[*]}" >&2 + echo "INFO: operating on repos from stage(s): ${STAGES[*]}" >&2 ;; - --quiet) - CI=1 # disable interactive prompts before destructive actions + --quiet) # suppress jfrog CLI interactive prompts unless --dry-run + if (( DRY_RUN )); then + echo "WARN: --quiet ignored because --dry-run" >&2 + else + QUIET=1 + CI=1 + fi shift ;; - --dry-run) - CI=0 # re-enable interactive prompts before destructive actions in case parent env has CI=1 + --dry-run) # re-enable jfrog CLI interactive safety prompts before destructive actions in case parent env has CI=1 + if (( QUIET )); then + echo "WARN: --quiet ignored because --dry-run" >&2 + fi + DRY_RUN=1 + CI=0 shift ;; --age)