File tree Expand file tree Collapse file tree 1 file changed +19
-12
lines changed
Expand file tree Collapse file tree 1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -230,22 +230,29 @@ jobs:
230230 steps :
231231 - name : Wait stable deployment
232232 run : |
233- while true; do
234- response=$(curl -s "https://${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it/health/")
235- commit=$(echo $response | jq -r '.version')
236- if [ "$commit" == "${{ needs.build-be.outputs.githash }}" ]; then
237- echo "New version live"
238- break
239- else
240- echo "Commit hash $commit does not match. Retrying..."
241- sleep 3
242- fi
243- done
244- shell : bash
233+ import requests
234+ import os
235+ import time
236+
237+ while True:
238+ response = requests.get(f"https://{os.getenv('URL')/health/")
239+ try:
240+ commit = response.json()['version']
241+ if commit == os.getenv('GITHASH'):
242+ print('New version live')
243+ break
244+ else:
245+ print('Commit hash does not match. Retrying...')
246+ time.sleep(2)
247+ except e:
248+ print('Failed to get version', e)
249+ shell : python
245250 env :
246251 AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
247252 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
248253 AWS_DEFAULT_REGION : eu-central-1
254+ URL : ${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it
255+ GITHASH : ${{ needs.build-be.outputs.githash }}
249256
250257 build-fe :
251258 needs : [wait-be-update]
You can’t perform that action at this time.
0 commit comments