I have github action file in that im running gcloud run deploy service in google cloud run.
We have 2 services running in cloud run and same applied through github action
- UI Service (frontend)
- API Service (backend)
Here is the action.yml of API Service (backend)
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{ env.GCR_SERVICE }} \
--image ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.IMAGE }}:${{ steps.date.outputs.date }} \
--region ${{ env.GCR_REGION }} \
--set-env-vars "TEST_API=https://test.dev.xxxx.co,TEST_SCHEDULE_ONE_API=https://xxxxxx,TEST_PERFORMANCE_ONE_API=https://xxxxxx,DB_URI=mongodb+srv://xxxxxx.mongo.ondigitalocean.com/webapp_test?xxxxxx,DB_NAME=webapp_test,US_WEST=https://xxxxxx,US_EAST=https://xxxxxx,EU_WEST=https://xxxxxx,ASIA_PACIPIC=https://xxxxxx" \
--platform managed \
--allow-unauthenticated \
--port=8080 \
--timeout=3600 \
--update-labels commit-sha=${{ github.sha }}
Im sharing just only cloud run deploy job because there only i thinking its not reflecting to actually database
Here is the action.yml of UI Service (frontend)
### Get the Deploying Container to Gooogle Cloud RUN ###
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{ env.GCR_SERVICE }} \
--image ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.IMAGE }}:${{ steps.date.outputs.date }} \
--region us-west1 \
--set-env-vars TEST_API_URL=https://api.dev.xxxx.co \
--platform managed \
--allow-unauthenticated \
--port=8080 \
--timeout=3600 \
--update-labels commit-sha=${{ github.sha }}
- name: 'Show output'
run: echo ${{ steps.deploy.outputs.url }}
Here is the screenshot that show its pointing to another databases
And in real it should point to API Service https://api.dev.xxxx.co/ but it point to https://webapp.api.xxxxxx.com/
Why its taking and where im wrong dont know
Question
Should i give key-value in gcloud run deploy in that like this TEST_API=https://test.dev.xxxx.co or TEST_API=test.dev.xxxx.co (which one is correct and wrong)
May i know what is the best to pass key-value variable through secret or env or gcloud run deploy or sed -i ‘s@TEST_API=.*$@TEST_API=https://dev.api.xxxx.co/@’ .env.dev
Most important how to i pass mongodb in gcloud run through github action