Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems that env_vars is being ignored when setting environment variables #183

Closed
igorkf opened this issue Aug 18, 2021 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@igorkf
Copy link

igorkf commented Aug 18, 2021

I'm trying to use env_vars to set three environment variables.
I saw this issue (160) and changed the version to 0.6.0 but the problem persists.
This is my .yml:

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

name: Build and Deploy a Container
env:
  PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
  SERVICE: ${{ secrets.GCP_APP_NAME }}
  REGION: us-central1

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Cloud SDK
        uses: google-github-actions/setup-gcloud@v0.2.0
        with:
          project_id: ${{ env.PROJECT_ID }}
          service_account_key: ${{ secrets.GCP_SA_KEY }}
          export_default_credentials: true # Set to true to authenticate the Cloud Run action

      - name: Authorize Docker push
        run: gcloud auth configure-docker

      - name: Build and Push Container
        run: |-
          docker build -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} .
          docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}

      - name: Deploy to Cloud Run
        id: deploy
        uses: google-github-actions/deploy-cloudrun@v0.6.0 
        with:
          service: ${{ env.SERVICE }}
          image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{  github.sha }}
          region: ${{ env.REGION }}
          env_vars: MODE_TOKEN=${{ secrets.MODE_TOKEN }},MODE_PASS=${{ secrets.MODE_PASS }},DISC_WEBHOOK_DATACHANNEL=${{ secrets.DISC_WEBHOOK_DATACHANNEL }}

      - name: Show Output
        run: echo ${{ steps.deploy.outputs.url }}

As you can see, I'm using google-github-actions/deploy-cloudrun@v0.6.0 when deploying to Cloud Run.
But when I check the logs from Github Actions, seems that he is using v0.4.0 instead of v0.6.0:
image

The env_vars options does not appeared in the logs, just service, image and region.

Am I doing something wrong?

@igorkf igorkf added the bug Something isn't working label Aug 18, 2021
@averikitsch
Copy link
Contributor

@igorkf I apologize for the lack of response. Are you still having this issue? I am unable to reproduce the issue.

@igorkf
Copy link
Author

igorkf commented Sep 26, 2021

Hi, no problem!
What I did to solve was to add the secrets directly by Cloud Run Console.
So I'm not working this task anymore.
By the way, thanks for the message.

@gustavovalverde
Copy link

I have projects using multiple env_vars, so this seems to be working as expected: https://github.com/opticrd/developer-portal-frontend/blob/main/.github/workflows/production.yml#L93

@igorkf
Copy link
Author

igorkf commented Sep 27, 2021

Thanks for your help. I will close this because seems that what @gustavovalverde proposed makes sense. I'm not working with this anymore, so I can't test it.
Thanks

@igorkf igorkf closed this as completed Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants