From f1b787567059cb27954f12044f4791865e5de962 Mon Sep 17 00:00:00 2001 From: Shea Stewart Date: Wed, 15 Jan 2025 17:38:25 -0500 Subject: [PATCH 1/2] update shell script to allow bypassing the --once flag --- src/docker/start.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/docker/start.sh b/src/docker/start.sh index e59d9e84..ce8e7912 100644 --- a/src/docker/start.sh +++ b/src/docker/start.sh @@ -177,7 +177,7 @@ if [ "$is_template_job" == "true" ]; then echo "Agent will be stopped after 1 min" # Run the agent for a minute timeout --preserve-status 1m bash run-docker.sh "$@" --once & -else +elif [ "$AZP_AGENT_ONETIME" == "true" ]; then # Unregister on success trap 'unregister; exit 0' EXIT # Unregister on Ctrl+C @@ -188,6 +188,8 @@ else sleep 60 && unregister & # Run the agent bash run-docker.sh "$@" --once & +else + bash run-docker.sh "$@" & fi # Fake the exit code of the agent for the prevent Kubernetes to detect the pod as failed (this is intended) From dd9afb13251f8c2e691ee774b652317689aea471 Mon Sep 17 00:00:00 2001 From: Shea Stewart Date: Wed, 15 Jan 2025 17:46:18 -0500 Subject: [PATCH 2/2] default to true if it's unset --- src/docker/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docker/start.sh b/src/docker/start.sh index ce8e7912..d16bc468 100644 --- a/src/docker/start.sh +++ b/src/docker/start.sh @@ -177,7 +177,7 @@ if [ "$is_template_job" == "true" ]; then echo "Agent will be stopped after 1 min" # Run the agent for a minute timeout --preserve-status 1m bash run-docker.sh "$@" --once & -elif [ "$AZP_AGENT_ONETIME" == "true" ]; then +elif [ "${AZP_AGENT_ONETIME:-true}" == "true" ]; then # Unregister on success trap 'unregister; exit 0' EXIT # Unregister on Ctrl+C