diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 7ba15b80b..12131568c 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -917,13 +917,21 @@ jobs: conclusion = 'failure'; summary = `in-tree e2e did not pass (result: ${E2E_RESULT})`; } - await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: 'E2E Tests', - head_sha: HEAD_SHA, - status: 'completed', - conclusion, - output: { title: 'E2E Tests', summary }, - }); + try { + await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'E2E Tests', + head_sha: HEAD_SHA, + status: 'completed', + conclusion, + output: { title: 'E2E Tests', summary }, + }); + } catch (err) { + // The 'E2E Tests' check-run is the required merge gate. If we + // cannot publish it, fail loudly and fail-closed: setFailed keeps + // the job (and thus the gate) red so the PR stays non-mergeable. + core.setFailed(`Failed to report E2E Tests check-run: ${err}`); + return; + } core.info(`E2E Tests → ${conclusion}: ${summary}`); diff --git a/hack/common-envs.mk b/hack/common-envs.mk index a4cc20868..8c48ff2af 100644 --- a/hack/common-envs.mk +++ b/hack/common-envs.mk @@ -83,13 +83,27 @@ BUILDX_ARGS := --provenance=false --push=$(PUSH) --load=$(LOAD) \ # for cluster-side pulls; the versioned and floating tags exist for human # discoverability and downstream tooling on releases. # When OCI_EXPORT_DIR is set it also appends a per-image `--output type=oci` -# so the build writes /.oci.tar (the tag becomes the archive's image -# name). Every package's buildx call routes its tags through this macro, so this -# is the single point that turns the whole build into an artifact-export build. -# $(comma) escapes the literal comma so make does not read it as an $(if …) -# argument separator; it is defined below and resolves at $(call) time. +# (via the oci-output macro) so the build writes /.oci.tar (the tag +# becomes the archive's image name). Every package's buildx call routes its tags +# through this macro, so this is the single point that turns the whole build into +# an artifact-export build — except recipes that bypass image-tags, which must +# call oci-output directly (see #3257). + +# comma emits a literal comma inside the lazily-expanded macros below +# (oci-output, cache-args) without make mis-reading it as an $(if …)/$(call …) +# argument separator. Defined here, above its first user, so it is unambiguously +# in scope wherever those macros are $(call)ed from a recipe. +comma := , + +# oci-output — when OCI_EXPORT_DIR is set, expands to a per-image +# `--output type=oci,dest=/.oci.tar`; empty otherwise. EVERY buildx +# call reachable from a fork build must include this — via image-tags, or +# directly for recipes that bypass image-tags (#3257). A missing archive is +# caught loudly by the fork build's `if-no-files-found: error` upload. +oci-output = $(if $(strip $(OCI_EXPORT_DIR)), --output type=oci$(comma)dest=$(OCI_EXPORT_DIR)/$(subst /,-,$(1)).oci.tar) + define image-tags ---tag $(REGISTRY)/$(1):$(IMAGE_TAG)$(if $(filter 1,$(PUBLISH_VERSIONED)),$(if $(filter-out $(IMAGE_TAG),$(strip $(2))), --tag $(REGISTRY)/$(1):$(strip $(2))))$(if $(filter 1,$(PUBLISH_FLOATING)), --tag $(REGISTRY)/$(1):latest)$(if $(strip $(OCI_EXPORT_DIR)), --output type=oci$(comma)dest=$(OCI_EXPORT_DIR)/$(subst /,-,$(1)).oci.tar) +--tag $(REGISTRY)/$(1):$(IMAGE_TAG)$(if $(filter 1,$(PUBLISH_VERSIONED)),$(if $(filter-out $(IMAGE_TAG),$(strip $(2))), --tag $(REGISTRY)/$(1):$(strip $(2))))$(if $(filter 1,$(PUBLISH_FLOATING)), --tag $(REGISTRY)/$(1):latest)$(call oci-output,$(1)) endef # cache-args [] @@ -101,9 +115,8 @@ endef # keep the cache manifest portable across registries (OCIR/ghcr/ECR). # defaults to `buildcache`; pass an explicit tag for images that build # a distinct artifact per loop iteration (e.g. ubuntu-container-disk per k8s ver). -# $(comma) escapes the literal commas in the --cache-to value so make does not -# mis-parse them as $(if ...) argument separators. -comma := , +# $(comma) (defined above) escapes the literal commas in the --cache-to value so +# make does not mis-parse them as $(if ...) argument separators. cache-args = --cache-from type=registry,ref=$(CACHE_REGISTRY)/$(1):$(if $(2),$(2),buildcache)$(if $(filter 1,$(WRITE_CACHE)), --cache-to type=registry$(comma)ref=$(CACHE_REGISTRY)/$(1):$(if $(2),$(2),buildcache)$(comma)mode=max$(comma)oci-mediatypes=true$(comma)image-manifest=true) ifeq ($(COZYSTACK_VERSION),) diff --git a/packages/system/capi-providers-cpprovider/Makefile b/packages/system/capi-providers-cpprovider/Makefile index 0f8be6c97..12bf5b535 100644 --- a/packages/system/capi-providers-cpprovider/Makefile +++ b/packages/system/capi-providers-cpprovider/Makefile @@ -21,7 +21,8 @@ image: --tag $(IMAGE_BASE):$(IMAGE_TAG) \ --tag $(IMAGE_BASE):$(IMAGE_TAG)-$(TAG) \ --cache-from type=registry,ref=$(IMAGE_BASE):latest \ - --cache-to type=inline \ + $(if $(strip $(OCI_EXPORT_DIR)),,--cache-to type=inline) \ + $(call oci-output,cluster-api-control-plane-provider-kamaji) \ --metadata-file images/cluster-api-control-plane-provider-kamaji.json \ $(BUILDX_ARGS) digest=$$(yq e '."containerimage.digest"' images/cluster-api-control-plane-provider-kamaji.json -o json -r); \