File tree Expand file tree Collapse file tree 4 files changed +30
-35
lines changed
Expand file tree Collapse file tree 4 files changed +30
-35
lines changed Original file line number Diff line number Diff line change 3333# If first cmd executes successfully then execute second cmd
3434runIfSuccessful () {
3535 echo " running: $1 "
36- $( $1 > /dev/null)
36+ $( $1 > /dev/null)
3737 if [ $? -eq 0 ]; then
3838 echo " running: $2 "
39- $( $2 > /dev/null)
39+ $( $2 > /dev/null)
4040 fi
4141}
4242
4343# Define max retries
44- max_attempts=3;
45- attempt_num=1;
44+ max_attempts=3
45+ attempt_num=1
4646
4747arg1=" $1 "
4848arg2=" $2 "
4949
50- if [ $# -eq 1 ]
51- then
50+ if [ $# -eq 1 ]; then
5251 cmd=" $arg1 "
5352else
5453 cmd=" runIfSuccessful \" $arg1 \" \" $arg2 \" "
5554fi
5655
57- until eval $cmd
58- do
59- if (( attempt_num== max_attempts))
60- then
61- echo " Attempt $attempt_num / $max_attempts failed! No more retries left!"
62- exit
63- else
64- echo " Attempt $attempt_num / $max_attempts failed!"
65- sleep $(( attempt_num++ ))
66- fi
56+ until eval $cmd ; do
57+ if (( attempt_num == max_attempts)) ; then
58+ echo " Attempt $attempt_num / $max_attempts failed! No more retries left!"
59+ exit 1
60+ else
61+ echo " Attempt $attempt_num / $max_attempts failed!"
62+ sleep $(( attempt_num++ ))
63+ fi
6764done
Original file line number Diff line number Diff line change @@ -40,8 +40,11 @@ describe('End-to-End Tests', () => {
4040 `gcloud builds submit --project ${ GOOGLE_CLOUD_PROJECT } ` +
4141 '--config ../renderer/test/e2e_test_setup.yaml ' +
4242 `--substitutions _SERVICE=renderer-${ SERVICE_NAME } ,_REGION=${ REGION } ` ;
43+
4344 if ( SAMPLE_VERSION ) buildRendererCmd += `,_VERSION=${ SAMPLE_VERSION } ` ;
44- if ( SERVICE_ACCOUNT ) buildRendererCmd += `,_SERVICE_ACCOUNT=${ SERVICE_ACCOUNT } ` ;
45+ if ( SERVICE_ACCOUNT ) {
46+ buildRendererCmd += `,_SERVICE_ACCOUNT=${ SERVICE_ACCOUNT } ` ;
47+ }
4548
4649 console . log ( 'Starting Cloud Build for Renderer service...' ) ;
4750 execSync ( buildRendererCmd , { cwd : '../renderer' } ) ;
Original file line number Diff line number Diff line change 3333# If first cmd executes successfully then execute second cmd
3434runIfSuccessful () {
3535 echo " running: $1 "
36- $( $1 > /dev/null)
36+ $( $1 > /dev/null)
3737 if [ $? -eq 0 ]; then
3838 echo " running: $2 "
39- $( $2 > /dev/null)
39+ $( $2 > /dev/null)
4040 fi
4141}
4242
4343# Define max retries
44- max_attempts=3;
45- attempt_num=1;
44+ max_attempts=3
45+ attempt_num=1
4646
4747arg1=" $1 "
4848arg2=" $2 "
4949
50- if [ $# -eq 1 ]
51- then
50+ if [ $# -eq 1 ]; then
5251 cmd=" $arg1 "
5352else
5453 cmd=" runIfSuccessful \" $arg1 \" \" $arg2 \" "
5554fi
5655
57- until eval $cmd
58- do
59- if (( attempt_num== max_attempts))
60- then
61- echo " Attempt $attempt_num / $max_attempts failed! No more retries left!"
62- exit
63- else
64- echo " Attempt $attempt_num / $max_attempts failed!"
65- sleep $(( attempt_num++ ))
66- fi
56+ until eval $cmd ; do
57+ if (( attempt_num == max_attempts)) ; then
58+ echo " Attempt $attempt_num / $max_attempts failed! No more retries left!"
59+ exit 1
60+ else
61+ echo " Attempt $attempt_num / $max_attempts failed!"
62+ sleep $(( attempt_num++ ))
63+ fi
6764done
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ describe('End-to-End Tests', () => {
3333 const { SERVICE_ACCOUNT } = process . env ;
3434 const REGION = 'us-central1' ;
3535
36-
3736 let BASE_URL ;
3837 before ( async ( ) => {
3938 // Deploy service using Cloud Build
@@ -55,7 +54,6 @@ describe('End-to-End Tests', () => {
5554 ) ;
5655 BASE_URL = url . toString ( 'utf-8' ) . trim ( ) ;
5756 if ( ! BASE_URL ) throw Error ( 'Cloud Run service URL not found' ) ;
58-
5957 } ) ;
6058
6159 after ( ( ) => {
You can’t perform that action at this time.
0 commit comments