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

feat: gcloud auth using workload identity #163

Merged
merged 6 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
env:
BRANCH: ${{ github.head_ref || github.ref_name }}

concurrency:
group: pre-commit-check
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
Expand Down
23 changes: 22 additions & 1 deletion infra/tools/gcloud/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,36 @@ inputs:
description: "List of additional gcloud components to install"
type: string

service_account:
required: false
description: "Service Account name for workload identity"
type: string
default: 'false'

workload_identity_provider:
required: false
description: "Workload identity provider"
type: string
default: 'false'

runs:
using: "composite"
steps:
- name: Authenticate to Google Cloud
- name: Authenticate to Google Cloud with SA
if: "${{ inputs.workload_identity_provider == 'false' }}"
uses: google-github-actions/auth@v2
with:
project_id: ${{ inputs.project_id }}
credentials_json: ${{ inputs.credentials_json }}

- name: Authenticate to Google Cloud with Workload Identity
if: "${{ (inputs.workload_identity_provider != 'false') && (inputs.service_account != 'false') }}"
uses: google-github-actions/auth@v2
with:
project_id: ${{ inputs.project_id }}
workload_identity_provider: ${{ inputs.workload_identity_provider }}
service_account: ${{ inputs.service_account }}

- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2
with:
Expand Down