From 21c5ceb05b01c2543e1fcdf90ecd434a3cff9cb1 Mon Sep 17 00:00:00 2001 From: Devanshu Date: Thu, 11 Sep 2025 23:22:18 +0530 Subject: [PATCH 1/4] Create workflow to run e2e tests on latest k8s Signed-off-by: Devanshu --- .github/workflows/kind-e2e-latest.yml | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/kind-e2e-latest.yml diff --git a/.github/workflows/kind-e2e-latest.yml b/.github/workflows/kind-e2e-latest.yml new file mode 100644 index 000000000..84136e101 --- /dev/null +++ b/.github/workflows/kind-e2e-latest.yml @@ -0,0 +1,73 @@ +name: Run E2E Kind + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + test-all: + runs-on: ubuntu-latest + env: + KIND_CLUSTER_NAME: kinder + K8S_VERSION: v1.34.1 + steps: + - name: install kind + uses: helm/kind-action@v1 + with: + install_only: true + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Verify go version + run: | + go version + - name: Install bazelisk + run: | + curl -Lo bazelisk https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 + chmod +x bazelisk + sudo mv bazelisk /usr/local/bin/bazel + + - name: Clone Kubernetes source at ${{ env.K8S_VERSION }} + run: | + git clone --depth 1 --branch ${K8S_VERSION} https://github.com/kubernetes/kubernetes.git + ls kubernetes + + - name: Debug working directories + run: | + echo "Workflow root: $PWD" + echo "Listing contents:" + ls -la + echo "Listing kubernetes source:" + ls -la kubernetes + + - name: Build KIND node image for Kubernetes ${{ env.K8S_VERSION }} + working-directory: ./kubernetes + run: | + kind build node-image --type=bazel --image kindest/node:${K8S_VERSION} + + - name: Create KIND cluster with custom image + run: | + kind create cluster --name $KIND_CLUSTER_NAME --image kindest/node:${K8S_VERSION} + + - name: Verify cluster is ready + run: kubectl cluster-info --context kind-${KIND_CLUSTER_NAME} + - name: Install Carvel Tools + run: ./hack/install-deps.sh + - name: Run tests + run: | + set -e -x + kubectl version + source ./hack/version-util.sh + ytt -f config/config -f config/values-schema.yml -f config-dev -v dev.version="$(get_kappctrl_ver)+develop" | kbld -f- > kbld.out 2> kbldmeta.out + cat kbldmeta.out | tail -n 1 | sed 's/.*final: kapp-controller -> \(.*\)$/\1/p' | tail -n 1 | xargs kind load docker-image --name kinder + kapp deploy -a kc -f kbld.out -c -y + export KAPPCTRL_E2E_SECRETGEN_CONTROLLER=true + source ./hack/secretgen-controller.sh + deploy_secretgen-controller + mkdir tmp + KAPPCTRL_E2E_NAMESPACE=kappctrl-test eval './hack/test-e2e.sh' \ No newline at end of file From af4988cc67d3faf176423b9cf59d252cab576184 Mon Sep 17 00:00:00 2001 From: Devanshu Date: Fri, 12 Sep 2025 16:30:40 +0530 Subject: [PATCH 2/4] Install latest kind binary Signed-off-by: Devanshu --- .github/workflows/kind-e2e-latest.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/kind-e2e-latest.yml b/.github/workflows/kind-e2e-latest.yml index 84136e101..730208e19 100644 --- a/.github/workflows/kind-e2e-latest.yml +++ b/.github/workflows/kind-e2e-latest.yml @@ -5,16 +5,17 @@ on: types: [opened, reopened, synchronize] jobs: - test-all: + test-k8s-1-34-1: runs-on: ubuntu-latest env: KIND_CLUSTER_NAME: kinder K8S_VERSION: v1.34.1 steps: - name: install kind - uses: helm/kind-action@v1 - with: - install_only: true + run: | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-$(uname)-amd64 + chmod +x ./kind + sudo mv ./kind /usr/local/bin/kind - name: Check out code into the Go module directory uses: actions/checkout@v4 with: From 8891f09a4bcbe6eb6b9289385616ff97dad79166 Mon Sep 17 00:00:00 2001 From: Devanshu Date: Sat, 13 Sep 2025 12:20:03 +0530 Subject: [PATCH 3/4] Run on k8s cluster 1.34.0 Signed-off-by: Devanshu --- .github/workflows/kind-e2e-latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kind-e2e-latest.yml b/.github/workflows/kind-e2e-latest.yml index 730208e19..fc9c5eb9f 100644 --- a/.github/workflows/kind-e2e-latest.yml +++ b/.github/workflows/kind-e2e-latest.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest env: KIND_CLUSTER_NAME: kinder - K8S_VERSION: v1.34.1 + K8S_VERSION: v1.34.0 steps: - name: install kind run: | From 027c7e9e05f0e0e4ccfc485ecaf0ec453f942814 Mon Sep 17 00:00:00 2001 From: Devanshu Date: Sat, 13 Sep 2025 19:49:05 +0530 Subject: [PATCH 4/4] Remove workflows Signed-off-by: Devanshu --- .github/workflows/kind-action.yml | 45 ---------------- .github/workflows/test-gh.yml | 84 ----------------------------- .github/workflows/test-kctrl-gh.yml | 63 ---------------------- 3 files changed, 192 deletions(-) delete mode 100644 .github/workflows/kind-action.yml delete mode 100644 .github/workflows/test-gh.yml delete mode 100644 .github/workflows/test-kctrl-gh.yml diff --git a/.github/workflows/kind-action.yml b/.github/workflows/kind-action.yml deleted file mode 100644 index bbb2e4148..000000000 --- a/.github/workflows/kind-action.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Kind Cluster E2E tests - -on: - pull_request: - types: [opened, reopened, synchronize] - paths-ignore: - - 'docs/**' - - '*.md' - - 'cli/**' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - run-tests: - runs-on: ubuntu-latest - steps: - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1 - with: - cluster_name: kinder - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - name: Install Carvel Tools - run: ./hack/install-deps.sh - # Run benchmark with `go test -bench` and stores the output to a file - - name: Install kc and run e2e tests on kind - run: | - set -e -x - kubectl version - source ./hack/version-util.sh - ytt -f config/config -f config/values-schema.yml -f config-dev -v dev.version="$(get_kappctrl_ver)+develop" | kbld -f- > kbld.out 2> kbldmeta.out - cat kbldmeta.out | tail -n 1 | sed 's/.*final: kapp-controller -> \(.*\)$/\1/p' | tail -n 1 | xargs kind load docker-image --name kinder - kapp deploy -a kc -f kbld.out -c -y - export KAPPCTRL_E2E_SECRETGEN_CONTROLLER=true - source ./hack/secretgen-controller.sh - deploy_secretgen-controller - mkdir tmp - KAPPCTRL_E2E_NAMESPACE=kappctrl-test eval './hack/test-e2e.sh' \ No newline at end of file diff --git a/.github/workflows/test-gh.yml b/.github/workflows/test-gh.yml deleted file mode 100644 index c1ad2532b..000000000 --- a/.github/workflows/test-gh.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: test-gh -"on": - push: - branches: - - develop - paths-ignore: - - 'docs/**' - - '*.md' - - 'cli/**' - pull_request: - types: [opened, reopened, synchronize] - paths-ignore: - - 'docs/**' - - '*.md' - - 'cli/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - test-all: - name: Run all tests - runs-on: ubuntu-latest - strategy: - fail-fast: false - max-parallel: 2 - matrix: - k8s-version: [v1.27.0, latest] - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - name: Resolve Kubernetes version - id: resolve-k8s-version - run: | - k8s_version=${{ matrix.k8s-version }} - if [ "${k8s_version}" = "latest" ]; then - k8s_version=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/kubernetes/kubernetes/releases/latest | grep -oE 'tag/v[0-9]+\.[0-9]+\.[0-9]+' | cut -d'/' -f2) - echo "Resolved latest k8s version to: $k8s_version" - fi - echo "k8s_version=$k8s_version" >> $GITHUB_ENV - - name: start minikube(k8s version ${{ env.k8s_version }}) - uses: medyagh/setup-minikube@latest - with: - kubernetes-version: ${{ env.k8s_version }} - driver: docker - start: true - cpus: 3 - memory: 8192m - - name: Verify env - run: | - kind version - kubectl version - go version - - name: Install Carvel Tools - run: ./hack/install-deps.sh - - name: Run Tests - run: | - set -e -x - mkdir /tmp/bin - export PATH=/tmp/bin:$PATH - - # Need to install protoc to run generators used in ./hack/verify-no-dirty-files.sh - curl -sLO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip - echo "b9ff821d2a4f9e9943dc2a13e6a76d99c7472dac46ddd3718a3a4c3b877c044a protoc-3.15.8-linux-x86_64.zip" | sha256sum -c - - unzip protoc-3.15.8-linux-x86_64.zip -d /tmp - - ./hack/verify-no-dirty-files.sh - - eval $(minikube docker-env --shell=bash) - - export KAPPCTRL_E2E_SECRETGEN_CONTROLLER=true - ./hack/deploy-test.sh - - export KAPPCTRL_E2E_NAMESPACE=kappctrl-test - kubectl create ns $KAPPCTRL_E2E_NAMESPACE - - ./hack/test-all.sh diff --git a/.github/workflows/test-kctrl-gh.yml b/.github/workflows/test-kctrl-gh.yml deleted file mode 100644 index 469de5ac3..000000000 --- a/.github/workflows/test-kctrl-gh.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: test-kctrl-gh -"on": - push: - branches: - - develop - paths-ignore: - - 'docs/**' - - '*.md' - pull_request: - types: [opened, reopened, synchronize] - paths-ignore: - - 'docs/**' - - '*.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - test-all: - name: Test kctrl GH - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go 1.x - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - name: Install Carvel Tools - uses: carvel-dev/setup-action@v2 - with: - only: ytt, kbld, imgpkg, vendir, kapp - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run Tests - run: | - set -e -x - - mkdir /tmp/bin - export PATH=/tmp/bin:$PATH - - # Need to install protoc to run generators used in ./hack/verify-no-dirty-files.sh - curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip - echo "b9ff821d2a4f9e9943dc2a13e6a76d99c7472dac46ddd3718a3a4c3b877c044a protoc-3.15.8-linux-x86_64.zip" | sha256sum -c - - unzip protoc-3.15.8-linux-x86_64.zip -d /tmp - - ./hack/verify-no-dirty-files.sh - - docker run -d -p 5000:5000 --restart=always --name registry registry:2 - - minikube start --driver=docker - eval $(minikube docker-env --shell=bash) - - ./hack/deploy-test.sh - - export KCTRL_E2E_NAMESPACE=kctrl-test - export KCTRL_E2E_IMAGE="`ifconfig | grep inet | grep -E '\b10\.' | awk '{ print $2}'`:5000/test-repo/testimage-$GITHUB_RUN_ID" - kubectl create ns $KCTRL_E2E_NAMESPACE - - cd cli - ./hack/test-all.sh