File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,5 +55,4 @@ stages:
5555 scriptType : bash
5656 scriptLocation : inlineScript
5757 addSpnToEnvironment : true
58- inlineScript : |
59- az containerapp job start --name manage-breast-screening-dbm-${{ env }} --resource-group rg-manbrs-${{ env }}-uks
58+ inlineScript : ./scripts/bash/db_migrate.sh ${{ env }}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ ENV=$1
6+ JOB_NAME=manage-breast-screening-dbm-${ENV}
7+ RG_NAME=rg-manbrs-${ENV} -uks
8+ TIMEOUT=300
9+ WAIT=5
10+ count=0
11+
12+ get_job_status () {
13+ az containerapp job execution show --job-execution-name " $execution_name " -n " $JOB_NAME " -g " $RG_NAME " | jq -r ' .properties.status'
14+ }
15+
16+ echo Starting job " $JOB_NAME " ...
17+ execution_name=$( az containerapp job start --name " $JOB_NAME " --resource-group " $RG_NAME " | jq -r ' .id|split("/")[-1]' )
18+
19+ while [[ $( get_job_status) = " Running" ]]; do
20+ echo The job " $execution_name " is still running...
21+ (( count* WAIT > TIMEOUT)) && break
22+ (( count+= 1 ))
23+ sleep $WAIT
24+ done
25+
26+ if (( count* WAIT > TIMEOUT)) ; then
27+ echo " The job \" $execution_name \" timed out (${TIMEOUT} s)"
28+ exit 1
29+ fi
30+
31+ status=$( get_job_status)
32+ if [[ $status = " Succeeded" ]]; then
33+ echo The job " $execution_name " completed successfully
34+ else
35+ echo The job " $execution_name " has not completed successfully. Status: " $status "
36+ exit 2
37+ fi
You can’t perform that action at this time.
0 commit comments