Skip to content

Commit 548d984

Browse files
authored
Merge pull request containerd#5132 from mikebrow/add-some-debug-out-for-dep-setups
adds a new install-deps in the makefile; and some refactoring of the scripts
2 parents bcda849 + 9ad87b9 commit 548d984

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ TESTFLAGS_PARALLEL ?= 8
123123
OUTPUTDIR = $(join $(ROOTDIR), _output)
124124
CRIDIR=$(OUTPUTDIR)/cri
125125

126-
.PHONY: clean all AUTHORS build binaries test integration generate protos checkprotos coverage ci check help install uninstall vendor release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration bin/cri-integration.test
126+
.PHONY: clean all AUTHORS build binaries test integration generate protos checkprotos coverage ci check help install uninstall vendor release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test
127127
.DEFAULT: default
128128

129129
all: binaries
@@ -262,6 +262,7 @@ release: releases/$(RELEASE).tar.gz
262262
@echo "$(WHALE) $@"
263263
@cd releases && sha256sum $(RELEASE).tar.gz >$(RELEASE).tar.gz.sha256sum
264264

265+
# install of cri deps into release output directory
265266
ifeq ($(GOOS),windows)
266267
install-cri-deps: $(BINARIES)
267268
mkdir -p $(CRIDIR)
@@ -343,6 +344,18 @@ uninstall:
343344
@echo "$(WHALE) $@"
344345
@rm -f $(addprefix $(DESTDIR)/bin/,$(notdir $(BINARIES)))
345346

347+
ifeq ($(GOOS),windows)
348+
install-deps:
349+
# TODO: need a script for hcshim something like containerd/cri/hack/install/windows/install-hcsshim.sh
350+
script/setup/install-critools
351+
script/setup/install-cni-windows
352+
else
353+
install-deps: ## install cri dependencies
354+
script/setup/install-seccomp
355+
script/setup/install-runc
356+
script/setup/install-critools
357+
script/setup/install-cni
358+
endif
346359

347360
coverage: ## generate coverprofiles from the unit tests, except tests that require root
348361
@echo "$(WHALE) $@"
@@ -373,7 +386,7 @@ root-coverage: ## generate coverage profiles for unit tests that require root
373386
fi; \
374387
done )
375388

376-
vendor:
389+
vendor: ## vendor
377390
@echo "$(WHALE) $@"
378391
@go mod tidy
379392
@go mod vendor

script/setup/critools-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0f5f734a7e1da0979915c6e7d5b6641bd9dc2627

script/setup/install-cni

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ CNI_COMMIT=$(grep containernetworking/plugins "$GOPATH"/src/github.com/container
2525
CNI_DIR=${DESTDIR:=''}/opt/cni
2626
CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d
2727

28-
git clone https://github.com/containernetworking/plugins.git "$GOPATH"/src/github.com/containernetworking/plugins
29-
cd "$GOPATH"/src/github.com/containernetworking/plugins
28+
TMPROOT=$(mktemp -d)
29+
git clone https://github.com/containernetworking/plugins.git "${TMPROOT}"/plugins
30+
pushd "${TMPROOT}"/plugins
3031
git checkout $CNI_COMMIT
3132
./build_linux.sh
3233
mkdir -p $CNI_DIR
@@ -66,3 +67,6 @@ cat << EOF | tee $CNI_CONFIG_DIR/10-containerd-net.conflist
6667
]
6768
}
6869
EOF
70+
71+
popd
72+
rm -fR "${TMPROOT}"

script/setup/install-critools

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,23 @@
2020
#
2121
set -eu -o pipefail
2222

23+
script_dir="$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1; pwd -P)"
24+
2325
cd "$GOPATH"
2426
go get -u github.com/onsi/ginkgo/ginkgo
25-
CRITEST_COMMIT=0f5f734a7e1da0979915c6e7d5b6641bd9dc2627
2627

27-
git clone https://github.com/kubernetes-sigs/cri-tools.git "$GOPATH"/src/github.com/kubernetes-sigs/cri-tools
28-
cd "$GOPATH"/src/github.com/kubernetes-sigs/cri-tools
28+
: "${CRITEST_COMMIT:=$(cat "${script_dir}/critools-version")}"
29+
30+
TMPROOT=$(mktemp -d)
31+
git clone https://github.com/kubernetes-sigs/cri-tools.git "${TMPROOT}"/cri-tools
32+
pushd "${TMPROOT}"/cri-tools
2933
git checkout "$CRITEST_COMMIT"
3034
make
3135
make install -e BINDIR=${DESTDIR:=''}/usr/local/bin
36+
3237
cat << EOF | tee ${DESTDIR}/etc/crictl.yaml
3338
runtime-endpoint: unix:///run/containerd/containerd.sock
3439
EOF
40+
41+
popd
42+
rm -fR "${TMPROOT}"

0 commit comments

Comments
 (0)