Skip to content

Commit

Permalink
if its the first deployment, there will be no previous revision (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolyachevets authored Oct 24, 2024
1 parent f915d44 commit d4ba40f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/actions/backend-deploy/files/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ steps:
echo "$DEPLOYED_REVISION" > /workspace/deployed_revision.txt
echo "Deployed revision: $DEPLOYED_REVISION"
# Update traffic to 0 for the new revision and wait for the new revision to be ready
gcloud run services update-traffic "${_APP_NAME}-${_DEPLOYMENT_ENV}" \
--region="${_REGION}" \
--project="$PROJECT_ID" \
--to-revisions="$PREVIOUS_REVISION=100"
if [[ -n "$PREVIOUS_REVISION" ]]; then
# Update traffic to 0 for the new revision and wait for the new revision to be ready
gcloud run services update-traffic "${_APP_NAME}-${_DEPLOYMENT_ENV}" \
--region="${_REGION}" \
--project="$PROJECT_ID" \
--to-revisions="$PREVIOUS_REVISION=100"
# Step 3: Trigger database migration job (if applicable)
- name: 'gcr.io/cloud-builders/gcloud'
Expand Down

0 comments on commit d4ba40f

Please sign in to comment.