actions-hub / gcloud

GitHub Action for interacting with Google Cloud Platform (GCP)
https://github.com/marketplace/actions/google-cloud-platform-gcp-cli-gcloud
MIT License
229 stars 28 forks source link

Warning is thrown when a multisep is configured with different APPLICATION_CREDENTIALS #17

Closed miguepintor closed 4 years ago

miguepintor commented 4 years ago

Given that you have two service accounts and one have access to one project and other have access to the other.

When you have a multistep like this:

name: gcloud
on: [push]

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: "deploy to project A"  
        uses: actions-hub/gcloud@master
        env:
          PROJECT_ID: ${{secrets.GCLOUD_PROJECT_ID_A}}
          APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS_A}}
        with:
          args: app deploy app.yaml

      - name: "deploy to project B"  
        uses: actions-hub/gcloud@master
        env:
          PROJECT_ID: ${{secrets.GCLOUD_PROJECT_ID_B}}
          APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS_B}}
        with:
          args: app deploy app.yaml

This error is thrown in the "deploy to project B" step: WARNING: You do not appear to have access to project [***] or it does not exist.

If you run each step in a separated job, it works.

exelban commented 4 years ago

Hi.

Yeap, it tried to use a credentials from the previous step. And it must to use new credentials. I will fix it.

miguepintor commented 4 years ago

@exelban thx!

exelban commented 4 years ago

It must work now.

miguepintor commented 4 years ago

It works perfectly @exelban. Thx for your support.