From 0837bee8f4cf6226e3b602c3f5e2d151d5ee0b9a Mon Sep 17 00:00:00 2001 From: Cesar Date: Tue, 2 Dec 2025 16:14:16 +0100 Subject: [PATCH 01/22] chore: add cache to the build stage --- .github/workflows/go_app_pull_requests.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 6e66d89..2e46423 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -230,7 +230,14 @@ jobs: # Setup Docker builder to do build. - name: Setup Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 + - name: Docker release meta + id: release + uses: docker/metadata-action@v4 + with: + images: ${{ github.repository }} + tags: type=sha + # Build the app. - name: Build uses: docker/build-push-action@v3 @@ -241,3 +248,5 @@ jobs: file: Dockerfile platforms: linux/amd64 tags: ${{ steps.release.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From 204037c32430bd4efef5522efa547201b2e2f1fb Mon Sep 17 00:00:00 2001 From: Cesar Date: Tue, 2 Dec 2025 16:29:56 +0100 Subject: [PATCH 02/22] chore: fix workflow --- .github/workflows/go_app_pull_requests.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 2e46423..85b45b6 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -231,12 +231,6 @@ jobs: - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 - - name: Docker release meta - id: release - uses: docker/metadata-action@v4 - with: - images: ${{ github.repository }} - tags: type=sha # Build the app. - name: Build From c9d0d0e4450952f3e92c3a8ca293086ff8b03d2e Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 09:56:15 +0100 Subject: [PATCH 03/22] chore: adding for integration-testsuite --- .github/workflows/go_app_pull_requests.yml | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 85b45b6..5842176 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -156,6 +156,37 @@ jobs: files: ./junit_report.xml name: junit-report token: ${{ secrets.CODECOV_TOKEN }} + # Cache Docker images for integration tests + - name: Cache integrations-testsuite Docker image + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + uses: actions/cache@v4 + with: + path: /tmp/.integrations-testsuite-cache + key: docker-integrations-testsuite-${{ runner.os }}-latest + restore-keys: | + docker-integrations-testsuite-${{ runner.os }}- + # Pre-pull integrations-testsuite image before running tests + - name: Load or pull integrations-testsuite Docker image + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + env: + ARTIFACT_REGISTRY: ${{ secrets.ARTIFACT_REGISTRY }} + run: | + # Try to load from cache first + if [ -f /tmp/.integrations-testsuite-cache/image.tar ]; then + echo "Loading integrations-testsuite from cache..." + docker load -i /tmp/.integrations-testsuite-cache/image.tar + else + echo "Cache miss, pulling integrations-testsuite:latest..." + docker pull ${ARTIFACT_REGISTRY}/integrations-testsuite:latest + + # Save for next time + mkdir -p /tmp/.integrations-testsuite-cache + docker save ${ARTIFACT_REGISTRY}/integrations-testsuite:latest \ + -o /tmp/.integrations-testsuite-cache/image.tar + fi + + # Verify image is available + docker images | grep integrations-testsuite || echo "Warning: integrations-testsuite image not found" # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests From 7d81079c59530ec32dcd36d5a870ddc4163b8622 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 10:15:14 +0100 Subject: [PATCH 04/22] chore: fix path --- .github/workflows/go_app_pull_requests.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 5842176..1b5f68a 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -171,18 +171,20 @@ jobs: env: ARTIFACT_REGISTRY: ${{ secrets.ARTIFACT_REGISTRY }} run: | + # Full image path with repository namespace + IMAGE="${ARTIFACT_REGISTRY}/kochava/integrations-testsuite:latest" + # Try to load from cache first if [ -f /tmp/.integrations-testsuite-cache/image.tar ]; then echo "Loading integrations-testsuite from cache..." docker load -i /tmp/.integrations-testsuite-cache/image.tar else - echo "Cache miss, pulling integrations-testsuite:latest..." - docker pull ${ARTIFACT_REGISTRY}/integrations-testsuite:latest + echo "Cache miss, pulling ${IMAGE}..." + docker pull ${IMAGE} # Save for next time mkdir -p /tmp/.integrations-testsuite-cache - docker save ${ARTIFACT_REGISTRY}/integrations-testsuite:latest \ - -o /tmp/.integrations-testsuite-cache/image.tar + docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar fi # Verify image is available From 33f8e470e0eea51acf68db2fd848c750e69d78ae Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 13:00:09 +0100 Subject: [PATCH 05/22] chore: cache extra docker images needed for e2e --- .github/workflows/go_app_pull_requests.yml | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 1b5f68a..e84db2e 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -26,6 +26,11 @@ on: description: "The duration before tests are stopped" type: string default: "10m" + DOCKER_CACHE_IMAGES: + description: "Comma-separated list of Docker images to pre-pull and cache for integration tests" + type: string + required: false + default: "" secrets: GH_CI_PAT: description: 'Token password for GitHub auth' @@ -189,6 +194,52 @@ jobs: # Verify image is available docker images | grep integrations-testsuite || echo "Warning: integrations-testsuite image not found" + # Cache custom Docker images (specified by caller) + - name: Cache custom Docker images + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} + uses: actions/cache@v4 + with: + path: /tmp/.custom-docker-cache + key: docker-custom-images-${{ runner.os }}-${{ hashFiles(inputs.DOCKER_CACHE_IMAGES) }} + restore-keys: | + docker-custom-images-${{ runner.os }}- + # Pre-pull custom Docker images before running tests + - name: Load or pull custom Docker images + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} + env: + IMAGES_LIST: ${{ inputs.DOCKER_CACHE_IMAGES }} + run: | + echo "Processing custom Docker images: $IMAGES_LIST" + + # Convert comma-separated string to array + IFS=',' read -ra IMAGES <<< "$IMAGES_LIST" + + mkdir -p /tmp/.custom-docker-cache + + for image in "${IMAGES[@]}"; do + # Trim whitespace + image=$(echo "$image" | xargs) + + if [ -z "$image" ]; then + continue + fi + + filename=$(echo "$image" | tr '/:' '_') + + if [ -f "/tmp/.custom-docker-cache/${filename}.tar" ]; then + echo "Loading $image from cache..." + docker load -i "/tmp/.custom-docker-cache/${filename}.tar" + else + echo "Cache miss, pulling $image..." + docker pull "$image" || echo "Warning: failed to pull $image" + + # Save for next time + docker save "$image" -o "/tmp/.custom-docker-cache/${filename}.tar" || echo "Warning: failed to save $image" + fi + done + + echo "✅ Custom Docker images ready" + docker images # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests From 68592f46c0043e2d5bf1f3e7ac28b468535efae0 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 13:48:39 +0100 Subject: [PATCH 06/22] chore: removing unused tools --- .github/workflows/go_app_pull_requests.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index e84db2e..2fd6815 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -135,6 +135,22 @@ jobs: # Install go-junit-report to format test results. - name: Install go-junit-report run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 + # Free up disk space before integration tests (removes ~30GB of unused tools) + - name: Free disk space + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + run: | + echo "Disk space before cleanup:" + df -h + + # Remove unnecessary tools and SDKs (not removing Docker cache/images) + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + echo "Disk space after cleanup:" + df -h # Run unit test for evet Go module. - name: build coverage output directories run: | From 14708274979050e388ccc202b8867161b1aa3953 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 14:34:15 +0100 Subject: [PATCH 07/22] chore: preserve go --- .github/workflows/go_app_pull_requests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 2fd6815..85bda1b 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -135,19 +135,18 @@ jobs: # Install go-junit-report to format test results. - name: Install go-junit-report run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 - # Free up disk space before integration tests (removes ~30GB of unused tools) + # Free up disk space before integration tests (removes ~25GB of unused tools) - name: Free disk space if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: | echo "Disk space before cleanup:" df -h - # Remove unnecessary tools and SDKs (not removing Docker cache/images) + # Remove unnecessary tools and SDKs (preserve Go and Docker) sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/local/lib/android sudo rm -rf /opt/ghc sudo rm -rf /opt/hostedtoolcache/CodeQL - sudo rm -rf "$AGENT_TOOLSDIRECTORY" echo "Disk space after cleanup:" df -h From e4149f3d557133dcb92bc15b5fc545ed5934cb29 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 14:48:08 +0100 Subject: [PATCH 08/22] chore: using a key for caching --- .github/workflows/go_app_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 85bda1b..3e75a2a 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -215,7 +215,7 @@ jobs: uses: actions/cache@v4 with: path: /tmp/.custom-docker-cache - key: docker-custom-images-${{ runner.os }}-${{ hashFiles(inputs.DOCKER_CACHE_IMAGES) }} + key: docker-custom-images-${{ runner.os }}-${{ hashFiles('go.sum') }}-v1 restore-keys: | docker-custom-images-${{ runner.os }}- # Pre-pull custom Docker images before running tests From 7f8d799052f2c172a01e35b6c66e0be6998dcf06 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 17:37:50 +0100 Subject: [PATCH 09/22] chore: address copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 3e75a2a..29adc2a 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -150,7 +150,7 @@ jobs: echo "Disk space after cleanup:" df -h - # Run unit test for evet Go module. + # Run unit test for every Go module. - name: build coverage output directories run: | mkdir -p coverage/unit @@ -176,13 +176,24 @@ jobs: files: ./junit_report.xml name: junit-report token: ${{ secrets.CODECOV_TOKEN }} + # Get the digest of the latest integrations-testsuite image + - name: Get integrations-testsuite image digest + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + id: image-digest + env: + ARTIFACT_REGISTRY: ${{ secrets.ARTIFACT_REGISTRY }} + run: | + IMAGE="${ARTIFACT_REGISTRY}/kochava/integrations-testsuite:latest" + # Get digest without pulling the full image (only manifest) + DIGEST=$(docker manifest inspect ${IMAGE} | sha256sum | cut -d' ' -f1) + echo "digest=${DIGEST}" >> $GITHUB_OUTPUT # Cache Docker images for integration tests - name: Cache integrations-testsuite Docker image if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} uses: actions/cache@v4 with: path: /tmp/.integrations-testsuite-cache - key: docker-integrations-testsuite-${{ runner.os }}-latest + key: docker-integrations-testsuite-${{ runner.os }}-${{ steps.image-digest.outputs.digest }} restore-keys: | docker-integrations-testsuite-${{ runner.os }}- # Pre-pull integrations-testsuite image before running tests @@ -256,7 +267,7 @@ jobs: echo "✅ Custom Docker images ready" docker images # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int - # to seperate out any integration tests + # to separate out any integration tests - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} -timeout ${{ inputs.GO_TEST_INTEGRATION_TIMEOUT }} ./... From 804a3f3f871faf73192023175b1b4bcd7e80f9a0 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 17:40:32 +0100 Subject: [PATCH 10/22] chore: apply a copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 29adc2a..b1cc01d 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -208,7 +208,14 @@ jobs: # Try to load from cache first if [ -f /tmp/.integrations-testsuite-cache/image.tar ]; then echo "Loading integrations-testsuite from cache..." - docker load -i /tmp/.integrations-testsuite-cache/image.tar + if docker load -i /tmp/.integrations-testsuite-cache/image.tar; then + echo "✓ Successfully loaded from cache" + else + echo "✗ Cache corrupted, pulling ${IMAGE}..." + docker pull ${IMAGE} + mkdir -p /tmp/.integrations-testsuite-cache + docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar + fi else echo "Cache miss, pulling ${IMAGE}..." docker pull ${IMAGE} From d5e904273ea2799974687bc257b908d1b48b6094 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 17:50:29 +0100 Subject: [PATCH 11/22] chore: apply a copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index b1cc01d..4dbbfad 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -233,7 +233,7 @@ jobs: uses: actions/cache@v4 with: path: /tmp/.custom-docker-cache - key: docker-custom-images-${{ runner.os }}-${{ hashFiles('go.sum') }}-v1 + key: docker-custom-images-${{ runner.os }}-${{ github.run_number / 20 }}-v1 restore-keys: | docker-custom-images-${{ runner.os }}- # Pre-pull custom Docker images before running tests From b970c83e26cc730b2de01a3104d9a568eb16bf20 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 17:52:39 +0100 Subject: [PATCH 12/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 4dbbfad..cb86c59 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -261,13 +261,19 @@ jobs: if [ -f "/tmp/.custom-docker-cache/${filename}.tar" ]; then echo "Loading $image from cache..." - docker load -i "/tmp/.custom-docker-cache/${filename}.tar" + if docker load -i "/tmp/.custom-docker-cache/${filename}.tar"; then + echo "✓ Successfully loaded $image from cache" + else + echo "✗ Cache corrupted, pulling $image..." + docker pull "$image" + docker save "$image" -o "/tmp/.custom-docker-cache/${filename}.tar" || echo "Warning: failed to cache $image" + fi else echo "Cache miss, pulling $image..." - docker pull "$image" || echo "Warning: failed to pull $image" + docker pull "$image" # Save for next time - docker save "$image" -o "/tmp/.custom-docker-cache/${filename}.tar" || echo "Warning: failed to save $image" + docker save "$image" -o "/tmp/.custom-docker-cache/${filename}.tar" || echo "Warning: failed to cache $image" fi done From f34aa60e50dd98e07e83f04588ce95c03ce3ada4 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 17:54:01 +0100 Subject: [PATCH 13/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index cb86c59..06bd3e1 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -357,7 +357,7 @@ jobs: # Build the app. - name: Build - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: push: false provenance: false From b3ec3e946105274f3536a7b6d1dc259fa0ab6665 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 17:55:20 +0100 Subject: [PATCH 14/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 06bd3e1..48fff97 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -226,7 +226,11 @@ jobs: fi # Verify image is available - docker images | grep integrations-testsuite || echo "Warning: integrations-testsuite image not found" + if ! docker images | grep -q integrations-testsuite; then + echo "Error: integrations-testsuite image not found after load/pull" + exit 1 + fi + echo "✅ integrations-testsuite image verified" # Cache custom Docker images (specified by caller) - name: Cache custom Docker images if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} From 6a2e2150628e438759a2a5e24fa1d20abcf39136 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 18:02:07 +0100 Subject: [PATCH 15/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 48fff97..cc06f89 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -226,7 +226,7 @@ jobs: fi # Verify image is available - if ! docker images | grep -q integrations-testsuite; then + if ! docker image inspect "${IMAGE}" >/dev/null 2>&1; then echo "Error: integrations-testsuite image not found after load/pull" exit 1 fi @@ -237,7 +237,7 @@ jobs: uses: actions/cache@v4 with: path: /tmp/.custom-docker-cache - key: docker-custom-images-${{ runner.os }}-${{ github.run_number / 20 }}-v1 + key: docker-custom-images-${{ runner.os }}-${{ github.run_number % 20 }}-v1 restore-keys: | docker-custom-images-${{ runner.os }}- # Pre-pull custom Docker images before running tests From b7b6410cfd551452e56d5fdd3507c9895f2006e1 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 18:05:12 +0100 Subject: [PATCH 16/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index cc06f89..635646c 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -231,15 +231,22 @@ jobs: exit 1 fi echo "✅ integrations-testsuite image verified" + # Get hash of Docker images list for cache key + - name: Hash Docker images list + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} + id: images-hash + run: | + HASH=$(echo "${{ inputs.DOCKER_CACHE_IMAGES }}" | sha256sum | cut -d' ' -f1 | head -c 12) + echo "hash=${HASH}" >> $GITHUB_OUTPUT # Cache custom Docker images (specified by caller) - name: Cache custom Docker images if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} uses: actions/cache@v4 with: path: /tmp/.custom-docker-cache - key: docker-custom-images-${{ runner.os }}-${{ github.run_number % 20 }}-v1 + key: docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}-${{ github.run_number % 20 }}-v1 restore-keys: | - docker-custom-images-${{ runner.os }}- + docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}- # Pre-pull custom Docker images before running tests - name: Load or pull custom Docker images if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} From d5484675284ed069edb77915c5e17b9091889b93 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 3 Dec 2025 18:49:15 +0100 Subject: [PATCH 17/22] chore: fix wrong use of id --- .github/workflows/go_app_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 635646c..88163cf 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -244,7 +244,7 @@ jobs: uses: actions/cache@v4 with: path: /tmp/.custom-docker-cache - key: docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}-${{ github.run_number % 20 }}-v1 + key: docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}-${{ github.run_number - (github.run_number % 20) }}-v1 restore-keys: | docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}- # Pre-pull custom Docker images before running tests From 0f79ecbb7140aeae198b9798a30bda6cececb7c0 Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 4 Dec 2025 10:10:26 +0100 Subject: [PATCH 18/22] chore: fix cache key calc --- .github/workflows/go_app_pull_requests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 88163cf..58a8b1c 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -238,13 +238,16 @@ jobs: run: | HASH=$(echo "${{ inputs.DOCKER_CACHE_IMAGES }}" | sha256sum | cut -d' ' -f1 | head -c 12) echo "hash=${HASH}" >> $GITHUB_OUTPUT + # Calculate cache slot (invalidate every 20 runs) + CACHE_SLOT=$(( ${{ github.run_number }} - (${{ github.run_number }} % 20) )) + echo "cache-slot=${CACHE_SLOT}" >> $GITHUB_OUTPUT # Cache custom Docker images (specified by caller) - name: Cache custom Docker images if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED && inputs.DOCKER_CACHE_IMAGES != '' }} uses: actions/cache@v4 with: path: /tmp/.custom-docker-cache - key: docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}-${{ github.run_number - (github.run_number % 20) }}-v1 + key: docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}-${{ steps.images-hash.outputs.cache-slot }}-v1 restore-keys: | docker-custom-images-${{ runner.os }}-${{ steps.images-hash.outputs.hash }}- # Pre-pull custom Docker images before running tests From 31a8770c76e85b12f91b9d1fd3b0ae6a61de8df1 Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 4 Dec 2025 10:24:33 +0100 Subject: [PATCH 19/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 58a8b1c..0b76165 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -214,7 +214,7 @@ jobs: echo "✗ Cache corrupted, pulling ${IMAGE}..." docker pull ${IMAGE} mkdir -p /tmp/.integrations-testsuite-cache - docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar + docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar || echo "Warning: failed to cache image" fi else echo "Cache miss, pulling ${IMAGE}..." @@ -222,7 +222,7 @@ jobs: # Save for next time mkdir -p /tmp/.integrations-testsuite-cache - docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar + docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar || echo "Warning: failed to cache image" fi # Verify image is available From 423eb2b479033e999cfdfa6a6ceb76ad040b9af1 Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 4 Dec 2025 10:26:18 +0100 Subject: [PATCH 20/22] chore: apply copilot fix --- .github/workflows/go_app_pull_requests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 0b76165..c6eaa81 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -185,7 +185,8 @@ jobs: run: | IMAGE="${ARTIFACT_REGISTRY}/kochava/integrations-testsuite:latest" # Get digest without pulling the full image (only manifest) - DIGEST=$(docker manifest inspect ${IMAGE} | sha256sum | cut -d' ' -f1) + # Extract the actual image digest from the manifest + DIGEST=$(docker manifest inspect ${IMAGE} | jq -r '.manifests[0].digest // .config.digest' | sed 's/sha256://') echo "digest=${DIGEST}" >> $GITHUB_OUTPUT # Cache Docker images for integration tests - name: Cache integrations-testsuite Docker image From 50e5aaee273c6dedbb16d343a8cc37426e91bed3 Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 4 Dec 2025 10:27:19 +0100 Subject: [PATCH 21/22] chore: apply copilot fix --- .github/workflows/go_app_pull_requests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index c6eaa81..aba0026 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -213,13 +213,13 @@ jobs: echo "✓ Successfully loaded from cache" else echo "✗ Cache corrupted, pulling ${IMAGE}..." - docker pull ${IMAGE} + docker pull ${IMAGE} || exit 1 mkdir -p /tmp/.integrations-testsuite-cache docker save ${IMAGE} -o /tmp/.integrations-testsuite-cache/image.tar || echo "Warning: failed to cache image" fi else echo "Cache miss, pulling ${IMAGE}..." - docker pull ${IMAGE} + docker pull ${IMAGE} || exit 1 # Save for next time mkdir -p /tmp/.integrations-testsuite-cache From 96594cc5a13d8add56aaee4e26835fd2fd32d105 Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 4 Dec 2025 10:28:11 +0100 Subject: [PATCH 22/22] chore: apply copilot suggestion --- .github/workflows/go_app_pull_requests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index aba0026..9fbf52f 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -280,12 +280,12 @@ jobs: echo "✓ Successfully loaded $image from cache" else echo "✗ Cache corrupted, pulling $image..." - docker pull "$image" + docker pull "$image" || exit 1 docker save "$image" -o "/tmp/.custom-docker-cache/${filename}.tar" || echo "Warning: failed to cache $image" fi else echo "Cache miss, pulling $image..." - docker pull "$image" + docker pull "$image" || exit 1 # Save for next time docker save "$image" -o "/tmp/.custom-docker-cache/${filename}.tar" || echo "Warning: failed to cache $image"