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

Use WIF instead of service account key #119

Merged
merged 2 commits into from
Jun 27, 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
7 changes: 3 additions & 4 deletions .github/actions/gcloud/deploy-app/action.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: "Code for Life - GCloud - Deploy App"
description: "Deploy an app to Google Cloud."
inputs:
gcp-credentials:
description: "The JSON credentials used to access GCP."
required: true
deploy-args:
description: "Arguments to pass to `gcloud app deploy`."
required: false
Expand All @@ -13,7 +10,9 @@ runs:
- name: 🗝 Authenticate with GCloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ inputs.gcp-credentials }}
project_id: 'decent-digit-629'
workload_identity_provider: 'projects/354656325390/locations/global/workloadIdentityPools/cfl-pool/providers/cfl-provider'
service_account: '[email protected]'

- name: 🤖 Set up GCloud SDK
uses: google-github-actions/setup-gcloud@v2
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
CODECOV_TOKEN:
description: "The token used to gain access to Codecov."
required: false
GCP_CREDENTIALS:
description: "The JSON credentials used to access GCP."
required: false

jobs:
validate-pr-refs:
Expand All @@ -28,6 +25,8 @@ jobs:
source-path: src

deploy:
permissions:
id-token: 'write' # TODO: separate build and deploy jobs and create reusable deploy workflow
runs-on: ubuntu-latest
needs: [validate-pr-refs, test]
# Deploy if:
Expand Down Expand Up @@ -82,5 +81,3 @@ jobs:

- name: 🚀 Deploy App on GCloud
uses: ocadotechnology/codeforlife-workspace/.github/actions/gcloud/deploy-app@main
with:
gcp-credentials: ${{ secrets.GCP_CREDENTIALS }}
3 changes: 2 additions & 1 deletion .github/workflows/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:

jobs:
deploy:
permissions:
id-token: 'write' # TODO: separate build and deploy jobs and create reusable deploy workflow
runs-on: ubuntu-latest
steps:
- name: 🛫 Checkout
Expand All @@ -18,5 +20,4 @@ jobs:
- name: 🚀 Deploy Cron Jobs on GCloud
uses: ocadotechnology/codeforlife-workspace/.github/actions/gcloud/deploy-app@main
with:
gcp-credentials: ${{ secrets.GCP_CREDENTIALS }}
deploy-args: cron.yaml
3 changes: 2 additions & 1 deletion .github/workflows/dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:

jobs:
deploy:
permissions:
id-token: 'write' # TODO: separate build and deploy jobs and create reusable deploy workflow
runs-on: ubuntu-latest
steps:
- name: 🛫 Checkout
Expand All @@ -18,5 +20,4 @@ jobs:
- name: 🚀 Deploy Routing Rules on GCloud
uses: ocadotechnology/codeforlife-workspace/.github/actions/gcloud/deploy-app@main
with:
gcp-credentials: ${{ secrets.GCP_CREDENTIALS }}
deploy-args: dispatch.yaml
7 changes: 2 additions & 5 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
CODECOV_TOKEN:
description: "The token used to gain access to Codecov."
required: false
GCP_CREDENTIALS:
description: "The JSON credentials used to access GCP."
required: false

jobs:
validate-pr-refs:
Expand All @@ -27,6 +24,8 @@ jobs:
node-version: ${{ inputs.node-version }}

deploy:
permissions:
id-token: 'write' # TODO: separate build and deploy jobs and create reusable deploy workflow
runs-on: ubuntu-latest
needs: [validate-pr-refs, test]
# Deploy if:
Expand Down Expand Up @@ -70,5 +69,3 @@ jobs:

- name: 🚀 Deploy App on GCloud
uses: ocadotechnology/codeforlife-workspace/.github/actions/gcloud/deploy-app@main
with:
gcp-credentials: ${{ secrets.GCP_CREDENTIALS }}