@@ -13,27 +13,12 @@ jobs:
1313 - name : Checkout code
1414 uses : actions/checkout@v4
1515
16- # - name: Run duplicate script
17- # env:
18- # SOURCE_GCP_MOBILITY_FEEDS_SA_KEY: ${{ secrets.PROD_GCP_MOBILITY_FEEDS_SA_KEY }}
19- # SOURCE_PROJECT_ID: ${{ vars.PROD_MOBILITY_FEEDS_PROJECT_ID }}
20- # DEST_GCP_MOBILITY_FEEDS_SA_KEY: ${{ secrets.QA_GCP_MOBILITY_FEEDS_SA_KEY }}
21- # DEST_PROJECT_ID: ${{ vars.QA_MOBILITY_FEEDS_PROJECT_ID }}
22- # GCP_REGION: ${{ vars.MOBILITY_FEEDS_REGION }}
23- # run: |
24- # echo "Key in yml:"
25- # echo "${{ secrets.PROD_GCP_MOBILITY_FEEDS_SA_KEY }}" | sed 's/./&./g'
26- # bash -x ./scripts/duplicate-prod-db.sh
27- #
28- #
29-
3016 - name : Authenticate to Google Cloud PROD project
3117 id : gcloud_auth_prod
3218 uses : google-github-actions/auth@v2
3319 with :
3420 credentials_json : ${{ secrets.PROD_GCP_MOBILITY_FEEDS_SA_KEY }}
3521
36-
3722 - name : GCloud Setup 1
3823 uses : google-github-actions/setup-gcloud@v2
3924
6247 GCP_REGION : ${{ vars.MOBILITY_FEEDS_REGION }}
6348 SQL_INSTANCE_NAME : ${{ secrets.DB_INSTANCE_NAME }}
6449 run : |
65- BUCKET_PROJECT_ID=$DEST_PROJECT_ID
66- # gcloud config set project $DEST_PROJECT_ID
50+ BUCKET_PROJECT_ID=$DEST_PROJECT_ID
6751
6852 # Check if the bucket already exists
6953 if ! gsutil ls -b "gs://${DUMP_BUCKET_NAME}" &> /dev/null; then
7660 # Give write permission for the source sql instance to write to the bucket
7761 gsutil iam ch serviceAccount:$SOURCE_SQL_SERVICE_ACCOUNT:objectCreator gs://$DUMP_BUCKET_NAME
7862
79- # Get the service account for the QA DB and give read permsssion to the bucket
63+ # Get the service account for the QA DB and give read permission to the bucket
8064 DEST_SQL_SERVICE_ACCOUNT=$(gcloud sql instances describe $SQL_INSTANCE_NAME --project=$DEST_PROJECT_ID --format="value(serviceAccountEmailAddress)")
8165 echo "Destination SQL Service Account: $DEST_SQL_SERVICE_ACCOUNT"
8266
8367 # Give read permission on the bucket to the destination sql instance
84- gsutil iam ch serviceAccount:$DEST_SQL_SERVICE_ACCOUNT:objectViewer gs://$DUMP_BUCKET_NAME
68+ gsutil iam ch serviceAccount:$DEST_SQL_SERVICE_ACCOUNT:objectViewer gs://$DUMP_BUCKET_NAME
0 commit comments