diff --git a/Makefile b/Makefile index f8ebf60ca136..c2392b7a122d 100644 --- a/Makefile +++ b/Makefile @@ -178,6 +178,11 @@ GOVULNCHECK_VER := v1.1.4 GOVULNCHECK := $(abspath $(TOOLS_BIN_DIR)/$(GOVULNCHECK_BIN)-$(GOVULNCHECK_VER)) GOVULNCHECK_PKG := golang.org/x/vuln/cmd/govulncheck +CRANE_BIN := crane +CRANE_VER := v0.20.7 +CRANE := $(abspath $(TOOLS_BIN_DIR)/$(CRANE_BIN)-$(CRANE_VER)) +CRANE_PKG := github.com/google/go-containerregistry/cmd/crane + IMPORT_BOSS_BIN := import-boss IMPORT_BOSS_VER := v0.28.1 IMPORT_BOSS := $(abspath $(TOOLS_BIN_DIR)/$(IMPORT_BOSS_BIN)) @@ -1449,6 +1454,9 @@ $(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint. .PHONY: $(GOVULNCHECK_BIN) $(GOVULNCHECK_BIN): $(GOVULNCHECK) ## Build a local copy of govulncheck. +.PHONY: $(CRANE_BIN) +$(CRANE_BIN): $(CRANE) ## Build a local copy of crane. + .PHONY: $(IMPORT_BOSS_BIN) $(IMPORT_BOSS_BIN): $(IMPORT_BOSS) @@ -1513,6 +1521,9 @@ $(GOLANGCI_LINT_270): $(GOVULNCHECK): # Build govulncheck. GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOVULNCHECK_PKG) $(GOVULNCHECK_BIN) $(GOVULNCHECK_VER) +$(CRANE): # Build crane. + GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CRANE_PKG) $(CRANE_BIN) $(CRANE_VER) + $(IMPORT_BOSS): # Build import-boss GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(IMPORT_BOSS_PKG) $(IMPORT_BOSS_BIN) $(IMPORT_BOSS_VER) diff --git a/scripts/ci-e2e-lib.sh b/scripts/ci-e2e-lib.sh index c2e7974991a9..0f707a846758 100644 --- a/scripts/ci-e2e-lib.sh +++ b/scripts/ci-e2e-lib.sh @@ -268,14 +268,29 @@ kind:prepullAdditionalImages () { # kind:prepullImage pre-pull a docker image if no already present locally. # The result will be available in the retVal value which is accessible from the caller. +# This uses crane to pull images instead of docker pull because loading images otherwise fails beginning with docker 29. +# - related kind issue: https://github.com/kubernetes-sigs/kind/issues/3795#issuecomment-3276124207 +# - related containerd issue: https://github.com/containerd/containerd/issues/11344 kind::prepullImage () { + make crane + local image=$1 image="${image//+/_}" retVal=0 if [[ "$(docker images -q "$image" 2> /dev/null)" == "" ]]; then + TMPFILE="$(mktemp)" + echo "+ Pulling $image" - docker pull "$image" || retVal=$? + + crane pull "$image" "${TMPFILE}" || retVal=$? + if [[ $retVal -gt 0 ]]; then + return + fi + + docker load -i "${TMPFILE}" || retVal=$? + + rm "${TMPFILE}" else echo "+ image $image already present in the system, skipping pre-pull" fi