From d470b50cf54782e5b4200d6d8f2ccd28b6da2e8d Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Sun, 26 May 2024 11:03:40 -0400 Subject: [PATCH] Fix logic to fetch secret in cloudbuily.yaml file --- cloudbuild.yaml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 3ceb044..bbeee73 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -6,30 +6,17 @@ steps: - name: "gcr.io/cloud-builders/docker" args: ["push", "us-central1-docker.pkg.dev/dreamboothy/registry-backend/registry-backend-image:$SHORT_SHA"] - # Fetch the database connection string secret for staging + # Fetch the secret and set environment variable for staging - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" entrypoint: "bash" args: - "-c" - | - STAGING_SUPABASE_CONNECTION_STRING=$(gcloud secrets versions access latest --secret="STAGING_SUPABASE_CONNECTION_STRING") - export STAGING_SUPABASE_CONNECTION_STRING=$STAGING_SUPABASE_CONNECTION_STRING - - # Install Atlas - - name: 'gcr.io/cloud-builders/curl' - entrypoint: 'sh' - args: - - '-c' - - | + export STAGING_DB_CONNECTION_STRING=$(gcloud secrets versions access latest --secret=STAGING_DB_CONNECTION_STRING) + + # Run database migrations for staging curl -sSL https://atlasgo.sh | sh - - # Run database migrations on staging environment - - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:latest' - entrypoint: 'bash' - args: - - '-c' - - | - atlas migrate apply --dir "ent/migrate/migrations" --url "$STAGING_SUPABASE_CONNECTION_STRING" + atlas migrate apply --dir "file://ent/migrate/migrations" --url "$STAGING_DB_CONNECTION_STRING" # Publish the release - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:458.0.1'