Skip to content

Commit 5b3e91a

Browse files
authored
Merge pull request #5417 from GSA/retry-restart
retry restart
2 parents df5de34 + cec5c2f commit 5b3e91a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/app-restart-template.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,24 @@ jobs:
3434
with:
3535
repository: gsa/data.gov
3636
path: "./datagov"
37-
- name: restart ${{ matrix.app }}
37+
- name: "restart ${{ matrix.app }}"
38+
id: restart1
39+
uses: cloud-gov/cg-cli-tools@main
40+
continue-on-error: true
41+
with:
42+
command: datagov/bin/check-and-renew ${{ matrix.app }} restart
43+
cf_org: gsa-datagov
44+
cf_space: ${{ inputs.environ }}
45+
cf_username: ${{secrets.CF_SERVICE_USER}}
46+
cf_password: ${{secrets.CF_SERVICE_AUTH}}
47+
- name: "wait 5-30 seconds before retry"
48+
if: ${{ steps.restart1.outcome == 'failure' }}
49+
run: |
50+
SLEEP=$(( (RANDOM % 26) + 5 ))
51+
echo "Sleeping $SLEEP seconds before retry"
52+
sleep "$SLEEP"
53+
- name: "restart again: ${{ matrix.app }}"
54+
if: ${{ steps.restart1.outcome == 'failure' }}
3855
uses: cloud-gov/cg-cli-tools@main
3956
with:
4057
command: datagov/bin/check-and-renew ${{ matrix.app }} restart

0 commit comments

Comments
 (0)