From 7ed16eb982ce39a55cd74feabe52df7d1bd46cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Fri, 23 Oct 2026 11:08:48 +0200 Subject: [PATCH] ci: cache Minikube downloads and retry a failed Minikube setup minikube start downloads the Kubernetes binaries (none driver) or the base and preloaded images (docker driver) on every run. With many matrix jobs starting at once, these downloads regularly time out (e.g. a TLS handshake timeout to dl.k8s.io) and fail the job before any test runs. Cache minikube's download cache keyed on the minikube and Kubernetes versions and the driver, and retry the setup once after cleaning up a failed attempt. --- .github/workflows/e2e-test.yml | 36 +++++++++++++++++++++---- .github/workflows/integration-tests.yml | 23 +++++++++++++++- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 9bb0e359a0..d5e2b76cc8 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -27,18 +27,44 @@ jobs: - "sample-operators/operations" - "sample-operators/kotlin-operator" runs-on: ubuntu-latest + env: + MINIKUBE_VERSION: v1.39.0 + # Use the latest versions supported by minikube, otherwise GitHub it will + # end up in a throttling requests from minikube and workflow will fail. + # Minikube does such requests only if a version is not officially supported. + KUBERNETES_VERSION: v1.37.0 steps: - name: Checkout uses: actions/checkout@v7 + # minikube downloads its base image and the preloaded Kubernetes images on every start, + # which regularly times out when many matrix jobs start at once + - name: Cache Minikube downloads + uses: actions/cache@v6 + with: + path: ${{ runner.temp }}/.minikube/cache + key: minikube-${{ runner.os }}-${{ env.MINIKUBE_VERSION }}-${{ env.KUBERNETES_VERSION }}-docker + - name: Setup Minikube-Kubernetes + id: minikube + continue-on-error: true + uses: manusa/actions-setup-minikube@v2.19.0 + with: + minikube version: ${{ env.MINIKUBE_VERSION }} + kubernetes version: ${{ env.KUBERNETES_VERSION }} + github token: ${{ secrets.GITHUB_TOKEN }} + driver: docker + + - name: Clean up failed Minikube setup + if: steps.minikube.outcome == 'failure' + run: '"$MINIKUBE_HOME/minikube" delete || true' + + - name: Setup Minikube-Kubernetes (retry) + if: steps.minikube.outcome == 'failure' uses: manusa/actions-setup-minikube@v2.19.0 with: - minikube version: 'v1.39.0' - # Use the latest versions supported by minikube, otherwise GitHub it will - # end up in a throttling requests from minikube and workflow will fail. - # Minikube does such requests only if a version is not officially supported. - kubernetes version: 'v1.37.0' + minikube version: ${{ env.MINIKUBE_VERSION }} + kubernetes version: ${{ env.KUBERNETES_VERSION }} github token: ${{ secrets.GITHUB_TOKEN }} driver: docker diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 31f69ec5e4..3f1353efea 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -28,6 +28,8 @@ jobs: runs-on: ubuntu-latest continue-on-error: ${{ inputs.experimental }} timeout-minutes: 120 + env: + MINIKUBE_VERSION: v1.39.0 steps: - uses: actions/checkout@v7 with: @@ -38,10 +40,29 @@ jobs: distribution: temurin java-version: ${{ inputs.java-version }} cache: 'maven' + # minikube downloads kubelet, kubeadm and kubectl from dl.k8s.io on every start, which + # regularly times out when many matrix jobs start at once + - name: Cache Minikube downloads + uses: actions/cache@v6 + with: + path: ${{ runner.temp }}/.minikube/cache + key: minikube-${{ runner.os }}-${{ env.MINIKUBE_VERSION }}-${{ inputs.kube-version }}-none - name: Set up Minikube + id: minikube + continue-on-error: true + uses: manusa/actions-setup-minikube@v2.19.0 + with: + minikube version: ${{ env.MINIKUBE_VERSION }} + kubernetes version: '${{ inputs.kube-version }}' + github token: ${{ github.token }} + - name: Clean up failed Minikube setup + if: steps.minikube.outcome == 'failure' + run: sudo -E --preserve-env=HOME,MINIKUBE_HOME "$MINIKUBE_HOME/minikube" delete || true + - name: Set up Minikube (retry) + if: steps.minikube.outcome == 'failure' uses: manusa/actions-setup-minikube@v2.19.0 with: - minikube version: 'v1.39.0' + minikube version: ${{ env.MINIKUBE_VERSION }} kubernetes version: '${{ inputs.kube-version }}' github token: ${{ github.token }}