From 6b616c197fdb53db73ef7ea7e2d555703c84d8ba Mon Sep 17 00:00:00 2001 From: Kosty Maleyev Date: Wed, 15 Nov 2023 17:58:35 -0800 Subject: [PATCH] [test] test ssh into GCP from GH Actions --- .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..74209505 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 }}."