google-github-actions / setup-gcloud

A GitHub Action for installing and configuring the gcloud CLI.
https://cloud.google.com/sdk/docs
Apache License 2.0
1.72k stars 512 forks source link

bq component fails when using Workload Identity Federation through /auth #647

Closed pramod-prabhakar-kapase-db closed 10 months ago

pramod-prabhakar-kapase-db commented 1 year ago

TL;DR

We are trying to create Bigquery Snapshot with bq command in Github workflow.

We authenticated service account via Workload Identity Federation We also did gcloud setup but when we try to run bq cp --snapshot, we are getting below error -

ERROR: (bq) Your current active account [SA Account] does not have any valid credentials

Expected behavior

bq command should run seamless without issue

Observed behavior

ERROR: (bq) Your current active account [SA Account] does not have any valid credentials

Action YAML

jobs:
  py-dataflow:
    name: Create BQ Snapshot    

    steps:
      - name: checkout code
        uses: actions/checkout@v3

      - name: Add Env
        shell: bash
        run: |
          export CLOUDSDK_PYTHON_SITEPACKAGES=1

      - name: GCP Auth
        uses: google-github-actions/auth@v1        
        with:
          workload_identity_provider:
          service_account: SA
          export_environment_variables: true
          create_credentials_file: true

      - name: Authenticate on GCP
        uses: google-github-actions/setup-gcloud@v1
        with:          
          service_account_email: SA
          export_default_credentials: true
          cleanup_credentials: false

      - name: Create BQ Table Snapshot
        shell: bash
        run: |
          echo "Creating Snapshot.."           

          gcloud auth list                            

          gcloud init

          bq cp \
          --snapshot \
          --no_clobber \
          --expiration=86400 \
          TABLE \
          TABLE_SNAP_08_07_2023

          echo "done.."

Log output

No response

Additional information

No response

sethvargo commented 1 year ago

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

sethvargo commented 10 months ago

Closing due to lack of reply. If this is still happening, please open a new issue. Thanks!