From 8fd2fd469b69668093fe3f13c6bb27edce955acc Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Wed, 13 Mar 2024 10:57:34 -0700 Subject: [PATCH 1/3] feat: add kind cluster creation for kubernetes acceptance tests --- native-provider-ci/src/action-versions.ts | 1 + native-provider-ci/src/steps.ts | 29 ++++++++--- native-provider-ci/src/workflows.ts | 59 ++++++++++++----------- 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/native-provider-ci/src/action-versions.ts b/native-provider-ci/src/action-versions.ts index 894e414feb..9c31301c2c 100644 --- a/native-provider-ci/src/action-versions.ts +++ b/native-provider-ci/src/action-versions.ts @@ -41,3 +41,4 @@ export const upgradeProviderAction = "pulumi/pulumi-upgrade-provider-action@v0.0.5"; export const slackNotification = "rtCamp/action-slack-notify@v2"; export const freeDiskSpace = "jlumbroso/free-disk-space@v1"; +export const createKindCluster = "helm/kind-action@v1"; diff --git a/native-provider-ci/src/steps.ts b/native-provider-ci/src/steps.ts index 9c6ec4de9d..2e831ad835 100644 --- a/native-provider-ci/src/steps.ts +++ b/native-provider-ci/src/steps.ts @@ -482,11 +482,13 @@ export function SetPackageVersionToEnv(): Step { }; } -export function RunTests(provider: string): Step { +export function RunTests(provider: string, name: string): Step { if (provider === "kubernetes") { + const shortMode = name === "run-acceptance-tests" ? " -short" : ""; + const testCmd = `cd tests/sdk/\${{ matrix.language }} && go test -v -count=1 -cover -timeout 2h -parallel 4${shortMode} ./...`; return { name: "Run tests", - run: "cd tests/sdk/${{ matrix.language }} && go test -v -count=1 -cover -timeout 2h -parallel 4 ./...", + run: testCmd, }; } return { @@ -832,8 +834,8 @@ export function UnTarProviderBinaries(provider: string, job: string): Step { }; } -export function MakeKubeDir(provider: string): Step { - if (provider === "kubernetes") { +export function MakeKubeDir(provider: string, name: string): Step { + if (provider === "kubernetes" && name !== "run-acceptance-tests") { return { name: "Make Kube Directory", run: 'mkdir -p "~/.kube/"', @@ -842,8 +844,8 @@ export function MakeKubeDir(provider: string): Step { return {}; } -export function DownloadKubeconfig(provider: string): Step { - if (provider === "kubernetes") { +export function DownloadKubeconfig(provider: string, name: string): Step { + if (provider === "kubernetes" && name !== "run-acceptance-tests") { return { name: "Download Kubeconfig", uses: action.downloadArtifact, @@ -1205,3 +1207,18 @@ export function FreeDiskSpace(): Step { }, }; } + +export function CreateKindCluster(provider: string, name: string): Step { + if (provider === "kubernetes" && name === "run-acceptance-tests") { + return { + name: "Setup KinD cluster", + uses: action.createKindCluster, + with: { + cluster_name: "kind-integration-tests-${{ matrix.language }}", + node_image: "kindest/node:v1.29.2", + }, + }; + } + + return {}; +} diff --git a/native-provider-ci/src/workflows.ts b/native-provider-ci/src/workflows.ts index 5cec926fea..b792b31d83 100644 --- a/native-provider-ci/src/workflows.ts +++ b/native-provider-ci/src/workflows.ts @@ -139,28 +139,16 @@ export function RunAcceptanceTestsWorkflow( build_sdks: new BuildSdkJob("build_sdks", opts, false) .addDispatchConditional(true) .addRunsOn(opts.provider), - test: new TestsJob("test", opts).addDispatchConditional(true), + test: new TestsJob(name, "test", opts).addDispatchConditional(true), sentinel: new EmptyJob("sentinel") .addConditional( "github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository" ) .addStep(steps.EchoSuccessStep()) - .addNeeds(calculateSentinelNeeds(opts.lint, opts.provider)), + .addNeeds(calculateSentinelNeeds(name, opts.lint, opts.provider)), }, }; if (opts.provider === "kubernetes") { - workflow.jobs = Object.assign(workflow.jobs, { - "build-test-cluster": new BuildTestClusterJob( - "build-test-cluster", - opts - ).addDispatchConditional(true), - }); - workflow.jobs = Object.assign(workflow.jobs, { - "destroy-test-cluster": new TeardownTestClusterJob( - "teardown-test-cluster", - opts - ).addDispatchConditional(true), - }); workflow.jobs = Object.assign(workflow.jobs, { lint: new LintKubernetesJob("lint").addDispatchConditional(true), }); @@ -175,6 +163,7 @@ export function RunAcceptanceTestsWorkflow( } function calculateSentinelNeeds( + workflowName: string, requiresLint: boolean, provider: string ): string[] { @@ -184,7 +173,7 @@ function calculateSentinelNeeds( needs.push("lint"); } - if (provider === "kubernetes") { + if (provider === "kubernetes" && workflowName !== "run-acceptance-tests") { needs.push("destroy-test-cluster"); } @@ -212,7 +201,7 @@ export function BuildWorkflow( build_sdks: new BuildSdkJob("build_sdks", opts, false).addRunsOn( opts.provider ), - test: new TestsJob("test", opts), + test: new TestsJob(name, "test", opts), publish: new PublishPrereleaseJob("publish", opts), publish_sdk: new PublishSDKJob("publish_sdk"), publish_java_sdk: new PublishJavaSDKJob("publish_java_sdk"), @@ -254,7 +243,7 @@ export function PrereleaseWorkflow( jobs: { prerequisites: new PrerequisitesJob("prerequisites", opts), build_sdks: new BuildSdkJob("build_sdks", opts, true), - test: new TestsJob("test", opts), + test: new TestsJob(name, "test", opts), publish: new PublishPrereleaseJob("publish", opts), publish_sdk: new PublishSDKJob("publish_sdk"), publish_java_sdk: new PublishJavaSDKJob("publish_java_sdk"), @@ -290,7 +279,7 @@ export function ReleaseWorkflow( jobs: { prerequisites: new PrerequisitesJob("prerequisites", opts), build_sdks: new BuildSdkJob("build_sdks", opts, true), - test: new TestsJob("test", opts), + test: new TestsJob(name, "test", opts), publish: new PublishJob("publish", opts), publish_sdk: new PublishSDKJob("publish_sdks"), publish_java_sdk: new PublishJavaSDKJob("publish_java_sdk"), @@ -567,13 +556,24 @@ export class TestsJob implements NormalJob { name: string; if: NormalJob["if"]; - constructor(name: string, opts: WorkflowOpts) { - if (opts.provider === "kubernetes") { + constructor(workflowName: string, jobName: string, opts: WorkflowOpts) { + if ( + opts.provider === "kubernetes" && + workflowName !== "run-acceptance-tests" + ) { this.needs = ["build_sdks", "build-test-cluster"]; } else if (opts.provider === "command") { this["runs-on"] = "ubuntu-latest"; } - this.name = name; + + if ( + opts.provider === "kubernetes" && + workflowName === "run-acceptance-tests" + ) { + this.strategy["fail-fast"] = false; + } + + this.name = jobName; this.permissions = { contents: "read", "id-token": "write", @@ -590,9 +590,9 @@ export class TestsJob implements NormalJob { steps.InstallPython(), steps.InstallJava(), steps.InstallGradle("7.6"), - steps.DownloadProviderBinaries(opts.provider, name), - steps.UnTarProviderBinaries(opts.provider, name), - steps.RestoreBinaryPerms(opts.provider, name), + steps.DownloadProviderBinaries(opts.provider, jobName), + steps.UnTarProviderBinaries(opts.provider, jobName), + steps.RestoreBinaryPerms(opts.provider, jobName), steps.DownloadSDKs(), steps.UnzipSDKs(), steps.UpdatePath(), @@ -600,18 +600,19 @@ export class TestsJob implements NormalJob { steps.SetNugetSource(), steps.InstallPythonDeps(), steps.InstallSDKDeps(), - steps.MakeKubeDir(opts.provider), - steps.DownloadKubeconfig(opts.provider), + steps.MakeKubeDir(opts.provider, workflowName), + steps.DownloadKubeconfig(opts.provider, workflowName), steps.ConfigureAwsCredentialsForTests(opts.aws), steps.GoogleAuth(opts.gcp), steps.SetupGCloud(opts.gcp), steps.InstallKubectl(opts.provider), steps.InstallandConfigureHelm(opts.provider), steps.SetupGotestfmt(), - steps.RunTests(opts.provider), + steps.CreateKindCluster(opts.provider, workflowName), + steps.RunTests(opts.provider, workflowName), steps.NotifySlack("Failure in SDK tests"), ].filter((step: Step) => step.uses !== undefined || step.run !== undefined); - Object.assign(this, { name }); + Object.assign(this, { name: jobName }); } addDispatchConditional(isWorkflowDispatch: boolean) { @@ -700,7 +701,7 @@ export class TeardownTestClusterJob implements NormalJob { steps.DestroyTestCluster(opts.provider), steps.DeleteArtifact(opts.provider), ].filter((step: Step) => step.uses !== undefined || step.run !== undefined); - Object.assign(this, { name }); + Object.assign(this, { name: name }); } addDispatchConditional(isWorkflowDispatch: boolean) { From 9e23c2a83edcc17b7bec050ba4bcc3651755a287 Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Wed, 13 Mar 2024 10:58:04 -0700 Subject: [PATCH 2/3] fix: set the correct version tag for jlumbroso/free-disk-space --- native-provider-ci/src/action-versions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native-provider-ci/src/action-versions.ts b/native-provider-ci/src/action-versions.ts index 9c31301c2c..8286017052 100644 --- a/native-provider-ci/src/action-versions.ts +++ b/native-provider-ci/src/action-versions.ts @@ -40,5 +40,5 @@ export const githubScript = "actions/github-script@v6"; export const upgradeProviderAction = "pulumi/pulumi-upgrade-provider-action@v0.0.5"; export const slackNotification = "rtCamp/action-slack-notify@v2"; -export const freeDiskSpace = "jlumbroso/free-disk-space@v1"; +export const freeDiskSpace = "jlumbroso/free-disk-space@v1.3.1"; // action does not support major version pinning, so we need to pin to exact version export const createKindCluster = "helm/kind-action@v1"; From c073a81fee5772c9625302ad818a89c93959819e Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Wed, 13 Mar 2024 11:01:18 -0700 Subject: [PATCH 3/3] chore: run `make` --- .../repo/.github/workflows/build.yml | 2 +- .../repo/.github/workflows/prerelease.yml | 2 +- .../repo/.github/workflows/release.yml | 2 +- .../repo/.github/workflows/build.yml | 2 +- .../repo/.github/workflows/prerelease.yml | 2 +- .../repo/.github/workflows/release.yml | 2 +- .../command/repo/.github/workflows/build.yml | 2 +- .../repo/.github/workflows/prerelease.yml | 2 +- .../repo/.github/workflows/release.yml | 2 +- .../repo/.github/workflows/build.yml | 2 +- .../repo/.github/workflows/prerelease.yml | 2 +- .../repo/.github/workflows/release.yml | 2 +- .../repo/.github/workflows/build.yml | 2 +- .../repo/.github/workflows/prerelease.yml | 2 +- .../repo/.github/workflows/release.yml | 2 +- .../workflows/run-acceptance-tests.yml | 136 +----------------- 16 files changed, 22 insertions(+), 144 deletions(-) diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml index c317c2d304..9039d1c6cd 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml @@ -356,7 +356,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml index 173dd8017f..99f163ffb8 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml @@ -347,7 +347,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml index 5ce63b205a..2fa85aaceb 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml @@ -347,7 +347,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/azure-native/repo/.github/workflows/build.yml b/native-provider-ci/providers/azure-native/repo/.github/workflows/build.yml index 2f2d99792c..6c76d79978 100644 --- a/native-provider-ci/providers/azure-native/repo/.github/workflows/build.yml +++ b/native-provider-ci/providers/azure-native/repo/.github/workflows/build.yml @@ -359,7 +359,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/azure-native/repo/.github/workflows/prerelease.yml b/native-provider-ci/providers/azure-native/repo/.github/workflows/prerelease.yml index 39d4e32968..0c08c47a41 100644 --- a/native-provider-ci/providers/azure-native/repo/.github/workflows/prerelease.yml +++ b/native-provider-ci/providers/azure-native/repo/.github/workflows/prerelease.yml @@ -350,7 +350,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/azure-native/repo/.github/workflows/release.yml b/native-provider-ci/providers/azure-native/repo/.github/workflows/release.yml index 65638ed5bc..7c491706c8 100644 --- a/native-provider-ci/providers/azure-native/repo/.github/workflows/release.yml +++ b/native-provider-ci/providers/azure-native/repo/.github/workflows/release.yml @@ -350,7 +350,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/command/repo/.github/workflows/build.yml b/native-provider-ci/providers/command/repo/.github/workflows/build.yml index be0907195e..be4117b1dd 100644 --- a/native-provider-ci/providers/command/repo/.github/workflows/build.yml +++ b/native-provider-ci/providers/command/repo/.github/workflows/build.yml @@ -319,7 +319,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/command/repo/.github/workflows/prerelease.yml b/native-provider-ci/providers/command/repo/.github/workflows/prerelease.yml index 8729141c62..35e988badc 100644 --- a/native-provider-ci/providers/command/repo/.github/workflows/prerelease.yml +++ b/native-provider-ci/providers/command/repo/.github/workflows/prerelease.yml @@ -310,7 +310,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/command/repo/.github/workflows/release.yml b/native-provider-ci/providers/command/repo/.github/workflows/release.yml index c271f1b6be..fdc35fa196 100644 --- a/native-provider-ci/providers/command/repo/.github/workflows/release.yml +++ b/native-provider-ci/providers/command/repo/.github/workflows/release.yml @@ -310,7 +310,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/google-native/repo/.github/workflows/build.yml b/native-provider-ci/providers/google-native/repo/.github/workflows/build.yml index 3ca3ce4254..691310930b 100644 --- a/native-provider-ci/providers/google-native/repo/.github/workflows/build.yml +++ b/native-provider-ci/providers/google-native/repo/.github/workflows/build.yml @@ -365,7 +365,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/google-native/repo/.github/workflows/prerelease.yml b/native-provider-ci/providers/google-native/repo/.github/workflows/prerelease.yml index 47f905f128..6bd939858f 100644 --- a/native-provider-ci/providers/google-native/repo/.github/workflows/prerelease.yml +++ b/native-provider-ci/providers/google-native/repo/.github/workflows/prerelease.yml @@ -356,7 +356,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/google-native/repo/.github/workflows/release.yml b/native-provider-ci/providers/google-native/repo/.github/workflows/release.yml index 85c5e6af89..80eb832fc1 100644 --- a/native-provider-ci/providers/google-native/repo/.github/workflows/release.yml +++ b/native-provider-ci/providers/google-native/repo/.github/workflows/release.yml @@ -356,7 +356,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/kubernetes/repo/.github/workflows/build.yml b/native-provider-ci/providers/kubernetes/repo/.github/workflows/build.yml index d4290427de..cce6549efe 100644 --- a/native-provider-ci/providers/kubernetes/repo/.github/workflows/build.yml +++ b/native-provider-ci/providers/kubernetes/repo/.github/workflows/build.yml @@ -392,7 +392,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/kubernetes/repo/.github/workflows/prerelease.yml b/native-provider-ci/providers/kubernetes/repo/.github/workflows/prerelease.yml index 845b00bf43..9a481ae435 100644 --- a/native-provider-ci/providers/kubernetes/repo/.github/workflows/prerelease.yml +++ b/native-provider-ci/providers/kubernetes/repo/.github/workflows/prerelease.yml @@ -383,7 +383,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/kubernetes/repo/.github/workflows/release.yml b/native-provider-ci/providers/kubernetes/repo/.github/workflows/release.yml index a183eacb6f..f0f3fdc899 100644 --- a/native-provider-ci/providers/kubernetes/repo/.github/workflows/release.yml +++ b/native-provider-ci/providers/kubernetes/repo/.github/workflows/release.yml @@ -383,7 +383,7 @@ jobs: with: go-version: ${{ env.GOVERSION }} - name: Clear GitHub Actions Ubuntu runner disk space - uses: jlumbroso/free-disk-space@v1 + uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false dotnet: false diff --git a/native-provider-ci/providers/kubernetes/repo/.github/workflows/run-acceptance-tests.yml b/native-provider-ci/providers/kubernetes/repo/.github/workflows/run-acceptance-tests.yml index 6551f9ae8f..a21ee3c1b1 100644 --- a/native-provider-ci/providers/kubernetes/repo/.github/workflows/run-acceptance-tests.yml +++ b/native-provider-ci/providers/kubernetes/repo/.github/workflows/run-acceptance-tests.yml @@ -251,9 +251,8 @@ jobs: runs-on: pulumi-ubuntu-8core needs: - build_sdks - - build-test-cluster strategy: - fail-fast: true + fail-fast: false matrix: language: - nodejs @@ -341,13 +340,6 @@ jobs: pip3 install pipenv - name: Install dependencies run: make install_${{ matrix.language}}_sdk - - name: Make Kube Directory - run: mkdir -p "~/.kube/" - - name: Download Kubeconfig - uses: actions/download-artifact@v4 - with: - name: config - path: ~/.kube/ - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -390,9 +382,14 @@ jobs: with: version: v2.5.0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup KinD cluster + uses: helm/kind-action@v1 + with: + cluster_name: kind-integration-tests-${{ matrix.language }} + node_image: kindest/node:v1.29.2 - name: Run tests run: cd tests/sdk/${{ matrix.language }} && go test -v -count=1 -cover -timeout - 2h -parallel 4 ./... + 2h -parallel 4 -short ./... - if: failure() && github.event_name == 'push' name: Notify Slack uses: 8398a7/action-slack@v3 @@ -413,125 +410,6 @@ jobs: needs: - test - lint - - destroy-test-cluster - build-test-cluster: - runs-on: ubuntu-latest - name: build-test-cluster - outputs: - stack-name: ${{ steps.stackname.outputs.stack-name }} - permissions: - contents: read - id-token: write - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - lfs: true - ref: ${{ env.PR_COMMIT_SHA }} - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GOVERSION }} - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEVERSION }} - registry-url: https://registry.npmjs.org - - name: Authenticate to Google Cloud - uses: google-github-actions/auth@v0 - with: - workload_identity_provider: projects/${{ env.GOOGLE_PROJECT_NUMBER - }}/locations/global/workloadIdentityPools/${{ - env.GOOGLE_CI_WORKLOAD_IDENTITY_POOL }}/providers/${{ - env.GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER }} - service_account: ${{ env.GOOGLE_CI_SERVICE_ACCOUNT_EMAIL }} - - name: Setup gcloud auth - uses: google-github-actions/setup-gcloud@v2 - with: - install_components: gke-gcloud-auth-plugin - - name: Install Kubectl - run: > - curl -LO - https://storage.googleapis.com/kubernetes-release/release/$(curl -s - https://storage.googleapis.com/kubernetes-release/release/stable-1.28.txt)/bin/linux/amd64/kubectl - - chmod +x ./kubectl - - sudo mv kubectl /usr/local/bin - - name: Login to Google Cloud Registry - run: gcloud --quiet auth configure-docker - - name: Set stack name in output - id: stackname - run: echo 'stack-name=${{ env.PULUMI_TEST_OWNER }}/${{ github.sha }}-${{ - github.run_id }}-${{ github.run_attempt }}' >> "$GITHUB_OUTPUT" - - name: Create test infrastructure - run: ./scripts/ci-cluster-create.sh ${{ steps.stackname.outputs.stack-name }} - - name: Upload Kubernetes Artifacts - uses: actions/upload-artifact@v4 - with: - name: config - path: ~/.kube/config - if: github.event_name == 'repository_dispatch' || - github.event.pull_request.head.repo.full_name == github.repository - destroy-test-cluster: - runs-on: ubuntu-latest - name: teardown-test-cluster - needs: - - build-test-cluster - - test - if: ${{ always() }} && github.event.pull_request.head.repo.full_name == - github.repository - permissions: - contents: read - id-token: write - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - lfs: true - ref: ${{ env.PR_COMMIT_SHA }} - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GOVERSION }} - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEVERSION }} - registry-url: https://registry.npmjs.org - - name: Authenticate to Google Cloud - uses: google-github-actions/auth@v0 - with: - workload_identity_provider: projects/${{ env.GOOGLE_PROJECT_NUMBER - }}/locations/global/workloadIdentityPools/${{ - env.GOOGLE_CI_WORKLOAD_IDENTITY_POOL }}/providers/${{ - env.GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER }} - service_account: ${{ env.GOOGLE_CI_SERVICE_ACCOUNT_EMAIL }} - - name: Setup gcloud auth - uses: google-github-actions/setup-gcloud@v2 - with: - install_components: gke-gcloud-auth-plugin - - name: Install Kubectl - run: > - curl -LO - https://storage.googleapis.com/kubernetes-release/release/$(curl -s - https://storage.googleapis.com/kubernetes-release/release/stable-1.28.txt)/bin/linux/amd64/kubectl - - chmod +x ./kubectl - - sudo mv kubectl /usr/local/bin - - name: Login to Google Cloud Registry - run: gcloud --quiet auth configure-docker - - name: Destroy test infra - run: ./scripts/ci-cluster-destroy.sh ${{ - needs.build-test-cluster.outputs.stack-name }} - - uses: geekyeggo/delete-artifact@v1 - with: - name: config lint: runs-on: ubuntu-latest steps: