google-github-actions / deploy-cloudrun

A GitHub Action for deploying services to Google Cloud Run.
https://cloud.google.com/run
Apache License 2.0
467 stars 115 forks source link

Secret var #528

Closed MarceloBuzzettiToolbox closed 5 months ago

MarceloBuzzettiToolbox commented 5 months ago

TL;DR

I try to set docker registry, docker.io, secret and use to deploy but not worked. image: "${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/${{ secrets.DOCKER_REPOSITORY }}:latest"

When i created it as repository variable worked image: "${{ vars.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/${{ secrets.DOCKER_REPOSITORY }}:latest"

Before asking me, I created the secret and repository variable DOCKER_REGISTRY correctly.

Expected behavior

Run using registry as secret

Observed behavior

Just work when used as repository variable

Action YAML

- name: Deploy on Cloud Run # Faz o deploy da aplicação no Cloud Run
        uses: 'google-github-actions/auth@v2' # Usa a ação de autenticação do Google Cloud
        with: # Define os parâmetros da ação
          workload_identity_provider: ${{ secrets.WORKLOAD_IDENTIFIER_PROVIDER }} # Define o provedor de identidade do workload
          service_account: ${{ secrets.SERVICE_ACCOUNT }} # Define a conta de serviço

      - id: 'deploy' # Define um ID para o passo
        uses: 'google-github-actions/deploy-cloudrun@v2' # Usa a ação de deploy no Cloud Run
        with: # Define os parâmetros da ação
          service: 'nodejs-toolbox-playground-exemplo' # Define o nome do serviço no Cloud Run
          image: "${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/${{ secrets.DOCKER_REPOSITORY }}:latest" # Define a imagem a ser usada no Cloud Run

Log output

google-github-actions/deploy-cloudrun failed with: failed to execute gcloud command `gcloud run deploy nodejs-toolbox-playground-exemplo --image ***/***/***:latest --update-labels ^,^managed-by=github-actions,commit-sha=6d33c3b6c54a2c6e27631cba0b51ab00960922bf --format json --region us-central1`: Deploying container to Cloud Run service [nodejs-toolbox-playground-exemplo] in project [toolbox-sandbox-388523] region [us-central1]

Additional information

No response

sethvargo commented 5 months ago

Hi there - could you please provide the debug output for the complete GitHub Actions workflow run?

MarceloBuzzettiToolbox commented 5 months ago

I'll enable that and send to you

MarceloBuzzettiToolbox commented 5 months ago

logs_24792883202.zip

sethvargo commented 5 months ago

What are the values for DOCKER_REGISTRY, DOCKER_NAMESPACE, and DOCKER_REPOSITORY? In general, these are not "secrets", so you might want to use vars instead so they aren't masked in the output. The value should be something like:

us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner
MarceloBuzzettiToolbox commented 5 months ago

What are the values for DOCKER_REGISTRY, DOCKER_NAMESPACE, and DOCKER_REPOSITORY? In general, these are not "secrets", so you might want to use vars instead so they aren't masked in the output. The value should be something like:

us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner

These are values about the repository on docker hub. I thought it was necessary to keep them secret. Thanks for the feedback. I'll use them as vars instead of secret