@@ -191,37 +191,9 @@ jobs:
191191 needs : [deploy-be, build-be]
192192 steps :
193193 - name : Wait stable deployment
194- run : |
195- import requests
196- import os
197- import time
198-
199- attempts = 0
200- while True:
201- response = requests.get(f"https://{os.getenv('URL')}/health/")
202- try:
203- commit = response.json()['version']
204- if commit == os.getenv('GITHASH'):
205- print('New version live')
206- break
207- else:
208- print('Commit hash does not match. Retrying...')
209- except Exception as e:
210- print('Failed to get version', e)
211-
212- attempts += 1
213-
214- if attempts > 30:
215- print('Failed to get new version')
216- exit(1)
217-
218- time.sleep(attempts)
219- shell : python
194+ uses : ./.github/actions/wait-for-deployment
220195 env :
221- AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
222- AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
223- AWS_DEFAULT_REGION : eu-central-1
224- URL : ${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it
196+ URL : https://${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it/health/
225197 GITHASH : ${{ needs.build-be.outputs.githash }}
226198
227199 build-fe :
@@ -350,35 +322,7 @@ jobs:
350322 needs : [deploy-fe, build-fe]
351323 steps :
352324 - name : Wait stable deployment
353- run : |
354- import requests
355- import os
356- import time
357-
358- attempts = 0
359- while True:
360- response = requests.get(f"https://{os.getenv('URL')}/api/health")
361- try:
362- commit = response.json()['version']
363- if commit == os.getenv('GITHASH'):
364- print('New version live')
365- break
366- else:
367- print('Commit hash does not match. Retrying...')
368- except Exception as e:
369- print('Failed to get version', e)
370-
371- attempts += 1
372-
373- if attempts > 30:
374- print('Failed to get new version')
375- exit(1)
376-
377- time.sleep(attempts)
378- shell : python
325+ uses : ./.github/actions/wait-for-deployment
379326 env :
380- AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
381- AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
382- AWS_DEFAULT_REGION : eu-central-1
383- URL : ${{ fromJSON('["pastaporto-frontend", "frontend"]')[github.ref == 'refs/heads/main'] }}.pycon.it
327+ URL : https://${{ fromJSON('["pastaporto-frontend", "frontend"]')[github.ref == 'refs/heads/main'] }}.pycon.it/api/health
384328 GITHASH : ${{ needs.build-fe.outputs.githash }}
0 commit comments