Skip to content

Authenticating via Service Account Key JSON does not work #73

@SeriyBg

Description

@SeriyBg

TL;DR

Moving from deprecated service_account_key in the google-github-actions/setup-gcloud to the credentials_json gives me the following error:

Error: google-github-actions/setup-gcloud failed with: Error parsing credentials: Unexpected end of JSON input
Ensure your credentials are base64 encoded or validate JSON format: 

I have also tried to encode the JSON key to base64 but it does not change the behaviour

Expected behavior

No response

Observed behavior

No response

Action YAML

name: Test on GKE
on:
  push: {}

env:
  PROJECT_ID: my-project
  GKE_ZONE: europe-west1-b

jobs:
  create-e-cluster:
    name: Create GKE cluster
    runs-on: ubuntu-latest
    outputs:
      cluster_name: my-cluster

    steps:
    # Setup gcloud CLI
    - id: 'auth'
      uses: 'google-github-actions/auth@v0.4.1'
      with:
        credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
    - uses: google-github-actions/setup-gcloud@master
      with:
        project_id: ${{ env.PROJECT_ID }}
        export_default_credentials: true

Additional information

It's not the issue with the JSON key itself, as the same value for the service_account_key in the google-github-actions/setup-gcloud is working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions