Skip to content

Commit 6f77fc5

Browse files
authored
Merge pull request #13119 from k8s-infra-cherrypick-robot/cherry-pick-13113-to-release-1.12
[release-1.12] 🌱 CAPD: set platform when saving image for preloading
2 parents b9f4cb7 + 2564041 commit 6f77fc5

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ GOVULNCHECK_VER := v1.1.4
176176
GOVULNCHECK := $(abspath $(TOOLS_BIN_DIR)/$(GOVULNCHECK_BIN)-$(GOVULNCHECK_VER))
177177
GOVULNCHECK_PKG := golang.org/x/vuln/cmd/govulncheck
178178

179+
CRANE_BIN := crane
180+
CRANE_VER := v0.20.7
181+
CRANE := $(abspath $(TOOLS_BIN_DIR)/$(CRANE_BIN)-$(CRANE_VER))
182+
CRANE_PKG := github.com/google/go-containerregistry/cmd/crane
183+
179184
IMPORT_BOSS_BIN := import-boss
180185
IMPORT_BOSS_VER := v0.28.1
181186
IMPORT_BOSS := $(abspath $(TOOLS_BIN_DIR)/$(IMPORT_BOSS_BIN))
@@ -1445,6 +1450,9 @@ $(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint.
14451450
.PHONY: $(GOVULNCHECK_BIN)
14461451
$(GOVULNCHECK_BIN): $(GOVULNCHECK) ## Build a local copy of govulncheck.
14471452

1453+
.PHONY: $(CRANE_BIN)
1454+
$(CRANE_BIN): $(CRANE) ## Build a local copy of crane.
1455+
14481456
.PHONY: $(IMPORT_BOSS_BIN)
14491457
$(IMPORT_BOSS_BIN): $(IMPORT_BOSS)
14501458

@@ -1506,6 +1514,9 @@ $(GOLANGCI_LINT_KAL): $(GOLANGCI_LINT) # Build golangci-lint-kal from custom con
15061514
$(GOVULNCHECK): # Build govulncheck.
15071515
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOVULNCHECK_PKG) $(GOVULNCHECK_BIN) $(GOVULNCHECK_VER)
15081516

1517+
$(CRANE): # Build crane.
1518+
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CRANE_PKG) $(CRANE_BIN) $(CRANE_VER)
1519+
15091520
$(IMPORT_BOSS): # Build import-boss
15101521
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(IMPORT_BOSS_PKG) $(IMPORT_BOSS_BIN) $(IMPORT_BOSS_VER)
15111522

scripts/ci-e2e-lib.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,29 @@ kind:prepullAdditionalImages () {
270270

271271
# kind:prepullImage pre-pull a docker image if no already present locally.
272272
# The result will be available in the retVal value which is accessible from the caller.
273+
# This uses crane to pull images instead of docker pull because loading images otherwise fails beginning with docker 29.
274+
# - related kind issue: https://github.com/kubernetes-sigs/kind/issues/3795#issuecomment-3276124207
275+
# - related containerd issue: https://github.com/containerd/containerd/issues/11344
273276
kind::prepullImage () {
277+
make crane
278+
274279
local image=$1
275280
image="${image//+/_}"
276281

277282
retVal=0
278283
if [[ "$(docker images -q "$image" 2> /dev/null)" == "" ]]; then
284+
TMPFILE="$(mktemp)"
285+
279286
echo "+ Pulling $image"
280-
docker pull "$image" || retVal=$?
287+
288+
crane pull "$image" "${TMPFILE}" || retVal=$?
289+
if [[ $retVal -gt 0 ]]; then
290+
return
291+
fi
292+
293+
docker load -i "${TMPFILE}" || retVal=$?
294+
295+
rm "${TMPFILE}"
281296
else
282297
echo "+ image $image already present in the system, skipping pre-pull"
283298
fi

0 commit comments

Comments
 (0)