Skip to content

Commit

Permalink
[test] test ssh into GCP from GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
realkosty authored Nov 16, 2023
1 parent 5701c70 commit 6b616c1
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: test
run-name: test run

on:
workflow_dispatch:

jobs:
default-job:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-22.04

steps:
- name: Get GCP_ env variables from empower-config/.gcloudrc
run: |
source empower-config/.gcloudrc
echo "GCP_WORKLOAD_IDENTITY_PROVIDER=$GCP_WORKLOAD_IDENTITY_PROVIDER" >> $GITHUB_OUTPUT
echo "GCP_SERVICE_ACCOUNT=$GCP_SERVICE_ACCOUNT" >> $GITHUB_OUTPUT
id: gcloudrc

- id: 'auth'
name: 'Authenticate Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: ${{ steps.gcloudrc.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ steps.gcloudrc.outputs.GCP_SERVICE_ACCOUNT }}

- name: 'Set up Google Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'

- name: 'Try ssh-ing into GCP host'
run: gcloud compute ssh empower-tda-and-crons --zone us-central1-a

- run: echo "Job status is ${{ job.status }}."

0 comments on commit 6b616c1

Please sign in to comment.