From 525aa20bd68f8f13a58441c9251198c61ece83b8 Mon Sep 17 00:00:00 2001 From: iam-karan-suresh Date: Thu, 9 Jul 2026 21:13:43 +0530 Subject: [PATCH 1/3] ci: breaking down the ci to improve Signed-off-by: iam-karan-suresh --- .github/workflows/e2e.yaml | 126 +++++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 54 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 70c011d8..60426f7f 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -6,20 +6,20 @@ on: - 'main' - 'release/**' jobs: - kind: + test: runs-on: ubuntu-latest permissions: - contents: read # for reading the repository code. + contents: read steps: - - name: Test suite setup - uses: fluxcd/gha-workflows/.github/actions/setup-kubernetes@v0.11.0 + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Setup Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: 1.26.x - - name: Enable integration tests - # Only run integration tests for main branch - if: github.ref == 'refs/heads/main' - run: | - echo 'GO_TEST_ARGS=-tags integration' >> $GITHUB_ENV + cache-dependency-path: | + **/go.sum + **/go.mod - name: Run controller tests env: TEST_AZURE_CLIENT_ID: ${{ secrets.TEST_AZURE_CLIENT_ID }} @@ -31,6 +31,20 @@ jobs: run: make test - name: Check if working tree is dirty run: make verify + e2e: + runs-on: ubuntu-latest + permissions: + contents: read # for reading the repository code. + steps: + - name: Test suite setup + uses: fluxcd/gha-workflows/.github/actions/setup-kubernetes@v0.11.0 + with: + go-version: 1.26.x + - name: Enable integration tests + # Only run integration tests for main branch + if: github.ref == 'refs/heads/main' + run: | + echo 'GO_TEST_ARGS=-tags integration' >> $GITHUB_ENV - name: Build container image run: | make docker-build IMG=test/kustomize-controller:latest \ @@ -55,49 +69,53 @@ jobs: make dev-deploy IMG=test/kustomize-controller:latest kubectl -n kustomize-system rollout status deploy/source-controller --timeout=1m kubectl -n kustomize-system rollout status deploy/kustomize-controller --timeout=1m - - name: Run tests for removing kubectl managed fields - run: | - kubectl create ns managed-fields - kustomize build github.com/stefanprodan/podinfo//kustomize?ref=6.3.5 > /tmp/podinfo.yaml - kubectl -n managed-fields apply -f /tmp/podinfo.yaml - kubectl -n managed-fields apply -f ./config/testdata/managed-fields - kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m - OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml) - if echo "$OUTDATA" | grep -q "kubectl";then - echo "kubectl client-side manager not removed" - exit 1 - fi - kubectl -n managed-fields apply --server-side --force-conflicts -f /tmp/podinfo.yaml - kubectl -n managed-fields annotate --overwrite kustomization/podinfo reconcile.fluxcd.io/requestedAt="$(date +%s)" - kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m - OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml) - if echo "$OUTDATA" | grep -q "kubectl";then - echo "kubectl server-side manager not removed" - exit 1 - fi - kubectl delete ns managed-fields - - name: Run overlays tests - run: | - kubectl -n kustomize-system apply -k ./config/testdata/overlays - kubectl -n kustomize-system wait kustomizations/webapp-staging --for=condition=ready --timeout=4m - kubectl -n kustomize-system wait kustomizations/webapp-production --for=condition=ready --timeout=4m - - name: Run dependencies tests - run: | - kubectl -n kustomize-system apply -k ./config/testdata/dependencies - kubectl -n kustomize-system wait kustomizations/common --for=condition=ready --timeout=4m - kubectl -n kustomize-system wait kustomizations/backend --for=condition=ready --timeout=4m - kubectl -n kustomize-system wait kustomizations/frontend --for=condition=ready --timeout=4m - - name: Run impersonation tests - run: | - kubectl -n impersonation apply -f ./config/testdata/impersonation - kubectl -n impersonation wait kustomizations/podinfo --for=condition=ready --timeout=4m - kubectl -n impersonation delete kustomizations/podinfo - until kubectl -n impersonation get deploy/podinfo 2>&1 | grep NotFound ; do sleep 2; done - - name: Run OCI tests - run: | - kubectl create ns oci - kubectl -n oci apply -f ./config/testdata/oci - kubectl -n oci wait kustomizations/oci --for=condition=ready --timeout=4m + - parallel: + - name: Run managed-fields tests + run: | + set -euo pipefail + kubectl create ns managed-fields + kustomize build github.com/stefanprodan/podinfo//kustomize?ref=6.3.5 > /tmp/podinfo.yaml + kubectl -n managed-fields apply -f /tmp/podinfo.yaml + kubectl -n managed-fields apply -f ./config/testdata/managed-fields + kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m + OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml) + if echo "$OUTDATA" | grep -q "kubectl";then + echo "kubectl client-side manager not removed" + exit 1 + fi + kubectl -n managed-fields apply --server-side --force-conflicts -f /tmp/podinfo.yaml + kubectl -n managed-fields annotate --overwrite kustomization/podinfo reconcile.fluxcd.io/requestedAt="$(date +%s)" + kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m + OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml) + if echo "$OUTDATA" | grep -q "kubectl";then + echo "kubectl server-side manager not removed" + exit 1 + fi + kubectl delete ns managed-fields + - name: Run overlays and dependencies tests + run: | + set -euo pipefail + echo ">>> Run overlays tests" + kubectl -n kustomize-system apply -k ./config/testdata/overlays + kubectl -n kustomize-system wait kustomizations/webapp-staging --for=condition=ready --timeout=4m + kubectl -n kustomize-system wait kustomizations/webapp-production --for=condition=ready --timeout=4m + echo ">>> Run dependencies tests" + kubectl -n kustomize-system apply -k ./config/testdata/dependencies + kubectl -n kustomize-system wait kustomizations/common --for=condition=ready --timeout=4m + kubectl -n kustomize-system wait kustomizations/backend --for=condition=ready --timeout=4m + kubectl -n kustomize-system wait kustomizations/frontend --for=condition=ready --timeout=4m + - name: Run impersonation and OCI tests + run: | + set -euo pipefail + echo ">>> Run impersonation tests" + kubectl -n impersonation apply -f ./config/testdata/impersonation + kubectl -n impersonation wait kustomizations/podinfo --for=condition=ready --timeout=4m + kubectl -n impersonation delete kustomizations/podinfo + until kubectl -n impersonation get deploy/podinfo 2>&1 | grep NotFound ; do sleep 2; done + echo ">>> Run OCI tests" + kubectl create ns oci + kubectl -n oci apply -f ./config/testdata/oci + kubectl -n oci wait kustomizations/oci --for=condition=ready --timeout=4m - name: Logs if: always() continue-on-error: true @@ -110,8 +128,8 @@ jobs: kubectl -n kustomize-system get gitrepositories -oyaml kubectl -n kustomize-system get kustomizations -oyaml kubectl -n kustomize-system get all - kubectl -n oci get ocirepository/oci -oyaml - kubectl -n oci get kustomization/oci -oyaml + kubectl -n oci get ocirepository/oci -oyaml || true + kubectl -n oci get kustomization/oci -oyaml || true sops-openbao: runs-on: ubuntu-latest permissions: From 6227532174976759626045cc8fe9f384c7922550 Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Sun, 12 Jul 2026 14:29:36 +0100 Subject: [PATCH 2/3] Move GO_TEST_ARGS to the job that needs it Signed-off-by: Matheus Pimenta --- .github/workflows/e2e.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 60426f7f..4b332aa0 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -20,6 +20,11 @@ jobs: cache-dependency-path: | **/go.sum **/go.mod + - name: Enable integration tests + # Only run integration tests for main branch + if: github.ref == 'refs/heads/main' + run: | + echo 'GO_TEST_ARGS=-tags integration' >> $GITHUB_ENV - name: Run controller tests env: TEST_AZURE_CLIENT_ID: ${{ secrets.TEST_AZURE_CLIENT_ID }} @@ -40,11 +45,6 @@ jobs: uses: fluxcd/gha-workflows/.github/actions/setup-kubernetes@v0.11.0 with: go-version: 1.26.x - - name: Enable integration tests - # Only run integration tests for main branch - if: github.ref == 'refs/heads/main' - run: | - echo 'GO_TEST_ARGS=-tags integration' >> $GITHUB_ENV - name: Build container image run: | make docker-build IMG=test/kustomize-controller:latest \ From d0e17f24d1aaca074d5f8dc18e3c0673a070beec Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Sun, 12 Jul 2026 14:42:39 +0100 Subject: [PATCH 3/3] Remove pipefail Signed-off-by: Matheus Pimenta --- .github/workflows/e2e.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 4b332aa0..3aea1b97 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -72,7 +72,6 @@ jobs: - parallel: - name: Run managed-fields tests run: | - set -euo pipefail kubectl create ns managed-fields kustomize build github.com/stefanprodan/podinfo//kustomize?ref=6.3.5 > /tmp/podinfo.yaml kubectl -n managed-fields apply -f /tmp/podinfo.yaml @@ -94,7 +93,6 @@ jobs: kubectl delete ns managed-fields - name: Run overlays and dependencies tests run: | - set -euo pipefail echo ">>> Run overlays tests" kubectl -n kustomize-system apply -k ./config/testdata/overlays kubectl -n kustomize-system wait kustomizations/webapp-staging --for=condition=ready --timeout=4m @@ -106,7 +104,6 @@ jobs: kubectl -n kustomize-system wait kustomizations/frontend --for=condition=ready --timeout=4m - name: Run impersonation and OCI tests run: | - set -euo pipefail echo ">>> Run impersonation tests" kubectl -n impersonation apply -f ./config/testdata/impersonation kubectl -n impersonation wait kustomizations/podinfo --for=condition=ready --timeout=4m