From 04860cc2eb0881764cd862bda843fc5c37d20353 Mon Sep 17 00:00:00 2001 From: Cezary Stanislawski Date: Thu, 1 Oct 2026 23:09:24 +0200 Subject: [PATCH 1/2] ci: cache Docker builds and run Helm tests on main --- .github/workflows/test-e2e-helm.yml | 43 +++++++++++++++++++++++++++++ .github/workflows/test-e2e.yml | 27 ++++++++++++++++-- .github/workflows/test-helm.yml | 7 +++++ Dockerfile | 2 +- 4 files changed, 76 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-e2e-helm.yml b/.github/workflows/test-e2e-helm.yml index a34c882..62b1ae5 100644 --- a/.github/workflows/test-e2e-helm.yml +++ b/.github/workflows/test-e2e-helm.yml @@ -7,8 +7,28 @@ concurrency: on: pull_request: paths: + - '**.go' - 'charts/**' - 'test/e2e-helm/**' + - 'test/utils/**' + - 'Dockerfile' + - '.dockerignore' + - 'hack/boilerplate.go.txt' + - 'Makefile' + - 'go.mod' + - 'go.sum' + - '.github/workflows/test-e2e-helm.yml' + push: + branches: + - main + paths: + - '**.go' + - 'charts/**' + - 'test/e2e-helm/**' + - 'test/utils/**' + - 'Dockerfile' + - '.dockerignore' + - 'hack/boilerplate.go.txt' - 'Makefile' - 'go.mod' - 'go.sum' @@ -56,6 +76,29 @@ jobs: install_only: true version: ${{ env.KIND_VERSION }} + - name: Prepare image inputs + run: make generate fmt + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 + with: + driver-opts: default-load=true + + - name: Build controller image + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 + with: + context: . + load: true + push: false + pull: true + tags: lifecycle-controller-helm-e2e:v0.0.1 + cache-from: type=gha,scope=helm-e2e + cache-to: type=gha,scope=helm-e2e,mode=max,ignore-error=true + - name: Run Helm E2E tests + env: + # Reuse the cache for the suite's make docker-build calls. + BUILDX_BUILDER: ${{ steps.buildx.outputs.name }} run: | make test-e2e-helm diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index d2a29b8..32de944 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -69,7 +69,30 @@ jobs: - name: Verify kind installation run: kind version - - name: Run E2E tests + - name: Prepare image inputs run: | go mod tidy - make test-e2e + make generate fmt + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 + with: + driver-opts: default-load=true + + - name: Build controller image + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 + with: + context: . + load: true + push: false + pull: true + tags: ghcr.io/cstanislawski/lifecycle-controller:dev + cache-from: type=gha,scope=controller-e2e + cache-to: type=gha,scope=controller-e2e,mode=max,ignore-error=true + + - name: Run E2E tests + env: + # Reuse the cache for the suite's make docker-build calls. + BUILDX_BUILDER: ${{ steps.buildx.outputs.name }} + run: make test-e2e diff --git a/.github/workflows/test-helm.yml b/.github/workflows/test-helm.yml index fe48d67..273584b 100644 --- a/.github/workflows/test-helm.yml +++ b/.github/workflows/test-helm.yml @@ -10,6 +10,13 @@ on: - 'charts/**' - 'Makefile' - '.github/workflows/test-helm.yml' + push: + branches: + - main + paths: + - 'charts/**' + - 'Makefile' + - '.github/workflows/test-helm.yml' permissions: {} diff --git a/Dockerfile b/Dockerfile index 1dfca3a..c6da8d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ COPY internal/ internal/ # was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -o manager cmd/main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details From 1cb80902e544aa0411e63fec53088c0181f9f45f Mon Sep 17 00:00:00 2001 From: Cezary Stanislawski Date: Thu, 1 Oct 2026 23:20:56 +0200 Subject: [PATCH 2/2] ci: rerun checks