File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -362,16 +362,28 @@ jobs:
362
362
363
363
- name : Break on failure
364
364
run : |
365
- sleep ${{ env .break_duration }}m
366
- if : ${{ failure() && steps.config_ach.outcome == 'success' && contains(fromJSON('["failure", "always"]'), env .break_on) }}
365
+ sleep ${{ inputs .break_duration }}m
366
+ if : ${{ failure() && steps.config_ach.outcome == 'success' && contains(fromJSON('["failure", "always"]'), inputs .break_on) }}
367
367
368
368
- name : Break on success
369
369
run : |
370
- sleep ${{ env .break_duration }}m
371
- if : ${{ steps.config_ach.outcome == 'success' && contains(fromJSON('["success", "always"]'), env .break_on) }}
370
+ sleep ${{ inputs .break_duration }}m
371
+ if : ${{ steps.config_ach.outcome == 'success' && contains(fromJSON('["success", "always"]'), inputs .break_on) }}
372
372
373
373
- name : Destroy
374
- run : terraform destroy -auto-approve -input=false
374
+ run : |
375
+ for attempt in $(seq 5); do
376
+ if terraform destroy -auto-approve -input=false -lock-timeout=200s; then
377
+ echo "Destroyed infrastructure on attempt $attempt"
378
+ exit 0
379
+ fi
380
+ echo "Failed to destroy infrastructure on attempt $attempt"
381
+ sleep 120
382
+ done
383
+ echo "Failed to destroy infrastructure after $attempt attempts"
384
+ echo "Forcefully destroying infrastructure"
385
+ terraform destroy -auto-approve -input=false -lock=false
386
+ exit 1
375
387
working-directory : ${{ github.workspace }}/terraform-kayobe-multinode
376
388
env :
377
389
OS_CLOUD : ${{ vars.OS_CLOUD }}
You can’t perform that action at this time.
0 commit comments