Skip to content

Commit 6d353cf

Browse files
committed
multinode: Fix break handling
The failure() function cannot be used outside of an if condition.
1 parent e5e1445 commit 6d353cf

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

.github/workflows/multinode.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,15 @@ jobs:
360360
${{ github.workspace }}/logs/
361361
if: ${{ always() && steps.config_ach.outcome == 'success' }}
362362

363-
- name: Break for manual interaction
363+
- name: Break on failure
364364
run: |
365-
function wait() {
366-
duration=${{ inputs.break_duration }}m
367-
echo "Breaking on failure for $duration"
368-
sleep $duration
369-
}
370-
371-
if [[ ${{ inputs.break_on }} =~ '(failure|always)' ]] && [[ ${{ failure() }} = 'true' ]]; then
372-
wait "failure"
373-
elif [[ ${{ inputs.break_on }} =~ '(success|always)' ]] && [[ ${{ failure() }} = 'false' ]]; then
374-
wait "success"
375-
fi
376-
if: ${{ always() && steps.config_ach.outcome == 'success' }}
365+
sleep ${{ env.break_duration }}m
366+
if: ${{ failure() && steps.config_ach.outcome == 'success' && contains(fromJSON('["failure", "always"]'), env.break_on) }}
367+
368+
- name: Break on success
369+
run: |
370+
sleep ${{ env.break_duration }}m
371+
if: ${{ steps.config_ach.outcome == 'success' && contains(fromJSON('["success", "always"]'), env.break_on) }}
377372

378373
- name: Destroy
379374
run: terraform destroy -auto-approve -input=false

0 commit comments

Comments
 (0)