You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=== A creation request for job1 should be recorded in the requests file. No request for job2 should exist since the process was terminated mid deployment.
# Start deployment in background, redirecting stderr to capture when deployment starts
4
+
$CLI bundle deploy 2>&1&
5
+
DEPLOY_PID=$!
6
+
7
+
# Wait for deployment to start by monitoring the requests file
8
+
# Once we see the job creation request starting, we know deployment is in progress
9
+
title "Wait until the deployment has started."
10
+
foriin {1..30};do
11
+
if [ -f out.requests.txt ] && jq -e 'select(.method == "POST" and (.path | contains("/api/2.2/jobs/create")))' out.requests.txt >/dev/null 2>&1;then
12
+
echo"Deployment in progress, sending interrupt signal..."
13
+
break
14
+
fi
15
+
sleep 0.1
16
+
done
17
+
18
+
# Send interrupt signal
19
+
trace kill -INT $DEPLOY_PID
20
+
21
+
# Wait for process to complete
22
+
errcode trace wait$DEPLOY_PID
23
+
24
+
# A deletion request for deploy.lock should have been recorded in the requests file
25
+
trace cat out.requests.txt | jq 'select(.method == "POST" and (.path | contains("workspace/delete")) and (.body.path | contains("deploy.lock")))'
26
+
27
+
title "A creation request for job1 should be recorded in the requests file. No request for job2 should exist since the process was terminated mid deployment."
=== A deletion request for job2 should be recorded in the requests file. No request for job1 should exist since the process was terminated mid destroy.
# First deploy the bundle so we have something to destroy
4
+
$CLI bundle deploy --auto-approve
5
+
6
+
# Start destroy in background, redirecting stderr to capture when destroy starts
7
+
$CLI bundle destroy --auto-approve 2>&1&
8
+
DESTROY_PID=$!
9
+
10
+
# Wait for destroy to start by monitoring for job deletion request
11
+
title "Wait until the destroy has started."
12
+
foriin {1..30};do
13
+
if [ -f out.requests.txt ] && jq -e 'select(.method == "POST" and (.path | contains("/api/2.2/jobs/delete")))' out.requests.txt >/dev/null 2>&1;then
14
+
echo"Destroy in progress, sending interrupt signal..."
15
+
break
16
+
fi
17
+
sleep 0.1
18
+
done
19
+
20
+
# Send interrupt signal
21
+
trace kill -INT $DESTROY_PID
22
+
23
+
# Wait for process to complete
24
+
errcode trace wait$DESTROY_PID
25
+
26
+
# A deletion request for destroy.lock should have been recorded in the requests file
27
+
trace cat out.requests.txt | jq 'select(.method == "POST" and (.path | contains("workspace/delete")) and (.body.path | contains("destroy.lock")))'
28
+
29
+
title "A deletion request for job2 should be recorded in the requests file. No request for job1 should exist since the process was terminated mid destroy."
0 commit comments