-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: implement new development environment (#628)
Replace the multiple bash scripts used to setup the `csi-driver` test environment with Terraform and Make. --------- Co-authored-by: Julian Tölle <[email protected]>
- Loading branch information
Showing
24 changed files
with
583 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,8 @@ jobs: | |
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
test-kubernetes: | ||
name: e2e k3s ${{ matrix.k3s }} | ||
kubernetes: | ||
name: kubernetes ${{ matrix.k3s }} | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
|
@@ -33,21 +33,22 @@ jobs: | |
concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k3s }} | ||
|
||
strategy: | ||
# The e2e tests are flaky and often one of the jobs fails. The default setting | ||
# causes all other currently running jobs to abort and all need to be restarted. | ||
fail-fast: false | ||
fail-fast: false # Continue tests matrix if a flaky run occur. | ||
matrix: | ||
include: | ||
# All k3s after January 2024 break our e2e tests, we hardcode | ||
# the versions for now until we can fix the source of this. | ||
- k3s: v1.26.12+k3s1 | ||
k8s-test: v1.26.12 | ||
- k3s: v1.27.9+k3s1 | ||
k8s-test: v1.27.9 | ||
- k3s: v1.28.5+k3s1 | ||
k8s-test: v1.28.5 | ||
- k3s: v1.29.0+k3s1 | ||
k8s-test: v1.29.0 | ||
- k3s: v1.26 | ||
k8s-test: v1.26.15 | ||
- k3s: v1.27 | ||
k8s-test: v1.27.15 | ||
- k3s: v1.28 | ||
k8s-test: v1.28.11 | ||
- k3s: v1.29 | ||
k8s-test: v1.29.6 | ||
|
||
env: | ||
K3S_CHANNEL: ${{ matrix.k3s }} | ||
K8S_TEST_VERSION: ${{ matrix.k8s-test }} | ||
ENV: gha-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.k3s }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -56,36 +57,48 @@ jobs: | |
with: | ||
go-version-file: go.mod | ||
|
||
- uses: hetznercloud/tps-action@main | ||
- uses: opentofu/setup-opentofu@v1 | ||
with: | ||
tofu_version: v1.7.2 # renovate: datasource=github-releases depName=opentofu/opentofu | ||
tofu_wrapper: false | ||
|
||
- uses: hetznercloud/setup-hcloud@v1 | ||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- uses: yokawasa/[email protected] | ||
with: | ||
setup-tools: | | ||
helm | ||
kubectl | ||
skaffold | ||
helm: v3.11.2 | ||
kubectl: v1.29.0 | ||
skaffold: v2.3.0 | ||
helm: v3.15.2 # renovate: datasource=github-releases depName=helm/helm | ||
kubectl: v1.29.6 # renovate: datasource=github-releases depName=kubernetes/kubernetes | ||
skaffold: v2.12.0 # renovate: datasource=github-releases depName=GoogleContainerTools/skaffold | ||
|
||
- name: Run tests | ||
env: | ||
K3S_VERSION: ${{ matrix.k3s }} | ||
K8S_TEST_VERSION: ${{ matrix.k8s-test }} | ||
SCOPE: gha-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.k3s }} | ||
run: | | ||
curl -sLS https://get.k3sup.dev | sh | ||
- name: Setup k3sup | ||
run: curl -sLS https://get.k3sup.dev | sh | ||
|
||
- name: Setup k8s test binaries | ||
run: make -C test/e2e/kubernetes bin | ||
|
||
trap "hack/dev-down.sh" EXIT | ||
source <(hack/dev-up.sh) | ||
- uses: hetznercloud/tps-action@main | ||
|
||
skaffold build --tag="e2e-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" | ||
tag=$(skaffold build --tag="e2e-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" --quiet --output="{{ (index .Builds 0).Tag }}") | ||
skaffold deploy --images=docker.io/hetznercloud/hcloud-csi-driver=$tag | ||
- name: Setup environment | ||
run: make -C dev up | ||
|
||
test/e2e/kubernetes/run-e2e-tests.sh | ||
- name: Run skaffold | ||
run: | | ||
source dev/files/env.sh | ||
skaffold run | ||
- name: Run parallel tests | ||
run: | | ||
source dev/files/env.sh | ||
make -C test/e2e/kubernetes parallel | ||
- name: Run serial tests | ||
run: | | ||
source dev/files/env.sh | ||
make -C test/e2e/kubernetes serial | ||
deploy-manifests: | ||
runs-on: ubuntu-latest | ||
|
@@ -95,7 +108,7 @@ jobs: | |
with: | ||
setup-tools: | | ||
helm | ||
helm: v3.11.2 | ||
helm: v3.11.2 # renovate: datasource=github-releases depName=helm/helm | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
|
@@ -117,7 +130,7 @@ jobs: | |
with: | ||
setup-tools: | | ||
helm | ||
helm: v3.11.2 | ||
helm: v3.11.2 # renovate: datasource=github-releases depName=helm/helm | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.terraform* | ||
terraform.tfstate | ||
terraform.tfstate.backup | ||
*.auto.tfvars | ||
|
||
files/* | ||
!files/.gitkeep | ||
|
||
.env |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
SHELL = bash | ||
.ONESHELL: | ||
|
||
ENV ?= dev | ||
K3S_CHANNEL ?= stable | ||
|
||
env.auto.tfvars: | ||
@echo 'name = "$(ENV)"' > "$@" | ||
@echo 'hcloud_token = "$(HCLOUD_TOKEN)"' >> "$@" | ||
@echo 'k3s_channel = "$(K3S_CHANNEL)"' >> "$@" | ||
|
||
.terraform: | ||
tofu init | ||
|
||
up: .terraform env.auto.tfvars | ||
tofu apply -auto-approve | ||
$(MAKE) port-forward | ||
|
||
down: .terraform env.auto.tfvars | ||
tofu destroy -auto-approve | ||
|
||
port-forward: | ||
source files/env.sh | ||
bash files/registry-port-forward.sh | ||
|
||
clean: | ||
rm -Rf files/* .terraform* terraform.tfstate* env.auto.tfvars |
Empty file.
Oops, something went wrong.