From ea2b0d9fd946012f477dd8471302f25e9712bc13 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Fri, 12 Jul 2024 15:46:10 +0100 Subject: [PATCH] Add sskPrivateKey option for test setup This addresses the use of the preTest hook in the docker provider. --- .../internal/pkg/templates/bridged-provider.config.yaml | 5 +++++ .../templates/bridged-provider/.github/workflows/main.yml | 6 ++++++ .../bridged-provider/.github/workflows/prerelease.yml | 6 ++++++ .../bridged-provider/.github/workflows/release.yml | 6 ++++++ .../.github/workflows/run-acceptance-tests.yml | 6 ++++++ 5 files changed, 29 insertions(+) diff --git a/provider-ci/internal/pkg/templates/bridged-provider.config.yaml b/provider-ci/internal/pkg/templates/bridged-provider.config.yaml index c995f148a0..166a874d5d 100644 --- a/provider-ci/internal/pkg/templates/bridged-provider.config.yaml +++ b/provider-ci/internal/pkg/templates/bridged-provider.config.yaml @@ -211,6 +211,11 @@ publish: # Used in 9 providers: https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22docker%3A%22&type=code #docker: false +# Setup SSH with specified private key before running tests in CI job. +# This should be provided from a secret +# Used by the docker provider only: https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22sshPrivateKey%3A%22&type=code +#sshPrivateKey: ${{ secrets.PRIVATE_SSH_KEY_FOR_DIGITALOCEAN }} + # Authenticate with GCP before running tests in CI job # Used in gcp and docker: https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22gcp%3A%22&type=code #gcp: false diff --git a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/main.yml b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/main.yml index 2495785010..1f465d795d 100644 --- a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/main.yml +++ b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/main.yml @@ -190,6 +190,12 @@ jobs: - name: Login to Google Cloud Registry run: gcloud --quiet auth configure-docker #{{- end }}# + #{{- if .Config.sshPrivateKey }}# + - name: Setup SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: #{{ .Config.sshPrivateKey }}# + #{{- end }}# #{{- if .Config.integrationTestProvider }}# - name: Prepare upstream code run: make upstream diff --git a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/prerelease.yml b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/prerelease.yml index 124822a538..c4961a8366 100644 --- a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/prerelease.yml +++ b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/prerelease.yml @@ -131,6 +131,12 @@ jobs: - name: Login to Google Cloud Registry run: gcloud --quiet auth configure-docker #{{- end }}# + #{{- if .Config.sshPrivateKey }}# + - name: Setup SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: #{{ .Config.sshPrivateKey }}# + #{{- end }}# #{{- if .Config.integrationTestProvider }}# - name: Prepare upstream code run: make upstream diff --git a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/release.yml b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/release.yml index 28d1c0ebd7..744112e17d 100644 --- a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/release.yml +++ b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/release.yml @@ -130,6 +130,12 @@ jobs: - name: Login to Google Cloud Registry run: gcloud --quiet auth configure-docker #{{- end }}# + #{{- if .Config.sshPrivateKey }}# + - name: Setup SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: #{{ .Config.sshPrivateKey }}# + #{{- end }}# #{{- if .Config.integrationTestProvider }}# - name: Prepare upstream code run: make upstream diff --git a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/run-acceptance-tests.yml b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/run-acceptance-tests.yml index acb18abbd1..e5e42b4495 100644 --- a/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/run-acceptance-tests.yml +++ b/provider-ci/internal/pkg/templates/bridged-provider/.github/workflows/run-acceptance-tests.yml @@ -173,6 +173,12 @@ jobs: - name: Login to Google Cloud Registry run: gcloud --quiet auth configure-docker #{{- end }}# + #{{- if .Config.sshPrivateKey }}# + - name: Setup SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: #{{ .Config.sshPrivateKey }}# + #{{- end }}# #{{- if .Config.integrationTestProvider }}# - name: Prepare upstream code run: make upstream