Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions sreagent-templates/bin/clone-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ Optional:
--override connectors.0.properties.dataSource=/subscriptions/.../new-ai
--backend Deploy backend: bicep (default) or terraform
--validate-only Run all validation checks without deploying
-y, --yes, --force Do not prompt before deploying (for unattended runs)
--skip-extras Deploy Bicep only, skip data-plane config
-h, --help Show this help
EOF
exit "${1:-0}"
}

SOURCE="" EXTRAS="" SECRETS="" NEW_AGENT="" NEW_RG="" NEW_LOC="" NEW_TARGET_RGS=""
NEW_SUB="" NEW_ACCESS="" NEW_ACTION="" VALIDATE_ONLY=false SKIP_EXTRAS=false
NEW_SUB="" NEW_ACCESS="" NEW_ACTION="" VALIDATE_ONLY=false SKIP_EXTRAS=false ASSUME_YES=false
FROM_AGENT="" FROM_RG="" FROM_SUB="" BACKEND="bicep"
declare -a OVERRIDES=()

Expand All @@ -79,6 +80,7 @@ while [[ $# -gt 0 ]]; do
--override) OVERRIDES+=("$2"); shift 2 ;;
--backend) BACKEND="$2"; shift 2 ;;
--validate-only) VALIDATE_ONLY=true; shift ;;
-y|--yes|--force) ASSUME_YES=true; shift ;;
--skip-extras) SKIP_EXTRAS=true; shift ;;
-h|--help) usage 0 ;;
*) echo "Unknown option: $1" >&2; usage 1 ;;
Expand Down Expand Up @@ -610,8 +612,16 @@ if [[ "$VALIDATE_ONLY" == "true" ]]; then
fi

echo
read -rp " Proceed with deployment? [y/N] " confirm
[[ "$confirm" =~ ^[Yy]$ ]] || { echo "Aborted."; exit 0; }
# Clone-Agent.ps1 has -Force; this is the same thing. Without it the only way to drive the
# script unattended is to pipe something into stdin, and that stdin is inherited by every
# child process -- piping an endless stream (`yes |`) makes `az rest` hang indefinitely,
# while piping a single line leaves `read` at EOF, which `set -e` turns into an exit.
if [[ "$ASSUME_YES" == "true" ]]; then
echo " Proceeding with deployment (--yes)."
else
read -rp " Proceed with deployment? [y/N] " confirm
[[ "$confirm" =~ ^[Yy]$ ]] || { echo "Aborted."; exit 0; }
fi

echo

Expand Down
Loading