Skip to content

Commit 467f842

Browse files
authored
Merge pull request #2 from stackhpc/break-condition
Misc fixes
2 parents de532a8 + df5ca87 commit 467f842

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/multinode.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,28 @@ jobs:
362362

363363
- name: Break on failure
364364
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) }}
367367

368368
- name: Break on success
369369
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) }}
372372

373373
- 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
375387
working-directory: ${{ github.workspace }}/terraform-kayobe-multinode
376388
env:
377389
OS_CLOUD: ${{ vars.OS_CLOUD }}

0 commit comments

Comments
 (0)