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

Update pulumi-kubernetes workflows to use kind and free up disk space #846

Merged
merged 3 commits into from
Mar 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion native-provider-ci/src/action-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ export const githubScript = "actions/github-script@v6";
export const upgradeProviderAction =
"pulumi/[email protected]";
export const slackNotification = "rtCamp/action-slack-notify@v2";
export const freeDiskSpace = "jlumbroso/free-disk-space@v1";
export const freeDiskSpace = "jlumbroso/[email protected]"; // action does not support major version pinning, so we need to pin to exact version
export const createKindCluster = "helm/kind-action@v1";
29 changes: 23 additions & 6 deletions native-provider-ci/src/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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/"',
Expand All @@ -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,
Expand Down Expand Up @@ -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 {};
}
Loading
Loading