Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,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))
Expand Down Expand Up @@ -1445,6 +1450,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)

Expand Down Expand Up @@ -1506,6 +1514,9 @@ $(GOLANGCI_LINT_KAL): $(GOLANGCI_LINT) # Build golangci-lint-kal from custom con
$(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)

Expand Down
17 changes: 16 additions & 1 deletion scripts/ci-e2e-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,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
Expand Down