From d9468deb2d0da7678668d7662ff1d1df8b09cb8b Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 4 Sep 2026 08:14:40 -0400 Subject: [PATCH] feat(docker): skip GHA cache for no-cache bake targets Docker workflow generation now reads each Bake target's `no-cache` setting and carries it into the matrix as a `cache` flag. Build definitions only emit `cache-from`/`cache-to` entries when caching is enabled, so targets marked `no-cache = true` avoid importing and exporting GitHub Actions cache. --- .github/workflows/__call-docker.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/__call-docker.yml b/.github/workflows/__call-docker.yml index deff8dea..1711681b 100644 --- a/.github/workflows/__call-docker.yml +++ b/.github/workflows/__call-docker.yml @@ -10,6 +10,7 @@ # runner. # Repositories without a Bake definition emit a warning and skip Docker builds. # `CI_PR` is set for Bake files that use a reduced pull-request platform list. +# Targets with `no-cache = true` do not import or export the GitHub Actions cache. # See https://docs.docker.com/build/bake/ for the standard file format. name: Docker (called) @@ -142,6 +143,7 @@ jobs: ), runner: runner($platform), artifacts: (($artifact_targets | index($target)) != null), + cache: (($definition.target[$target]["no-cache"] // false) == false), name: $name, tag: (if $name == "" then "" else "-" + $name end) } @@ -230,6 +232,7 @@ jobs: GH_EVENT_REPOSITORY_CLONE_URL: ${{ github.event.repository.clone_url }} PUBLISH_RELEASE: ${{ inputs.publish_release }} RELEASE_VERSION: ${{ inputs.release_version }} + USE_CACHE: ${{ matrix.cache }} shell: bash run: | branch="${BRANCH:-master}" @@ -251,8 +254,11 @@ jobs: echo "${target}.args.COMMIT=${commit}" echo "${target}.args.CLONE_URL=${GH_EVENT_REPOSITORY_CLONE_URL}" echo "${target}.args.RELEASE=${PUBLISH_RELEASE}" - echo "${target}.cache-from=type=gha,scope=${cache_scope}" - echo "${target}.cache-to=type=gha,mode=max,scope=${cache_scope}" + + if [[ "${USE_CACHE}" == "true" ]]; then + echo "${target}.cache-from=type=gha,scope=${cache_scope}" + echo "${target}.cache-to=type=gha,mode=max,scope=${cache_scope}" + fi if [[ "${PUBLISH_RELEASE}" == "true" ]]; then image_output="${target}.output=type=image,\"name=${base_tag},ghcr.io/${base_tag}\""