From 6dcf27f8cb4f1d44feec1fd9fd7bbc22b8505eb8 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 17 Oct 2017 10:07:35 -0600 Subject: [PATCH 1/4] Issue #1024: don't chmod a nonexistent file New network test makes improper assumptions about conmon path. Use predefined CONMON_BINARY variable instead. Signed-off-by: Ed Santiago --- test/network.bats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/network.bats b/test/network.bats index d9d0304b..294ef217 100644 --- a/test/network.bats +++ b/test/network.bats @@ -171,11 +171,11 @@ function teardown() { # make conmon non-executable to cause the sandbox setup to fail after # networking has been configured - chmod 0644 /go/src/github.com/kubernetes-incubator/cri-o/conmon/conmon + chmod 0644 $CONMON_BINARY run crioctl pod run --config "$TESTDATA"/sandbox_config.json + chmod 0755 $CONMON_BINARY echo "$output" [ "$status" -ne 0 ] - chmod 0755 /go/src/github.com/kubernetes-incubator/cri-o/conmon/conmon # ensure that the server cleaned up sandbox networking if the sandbox # failed after network setup From e78c44fe25a0cbc67ae0fa81ed4403df6298aa58 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 17 Oct 2017 11:00:26 -0600 Subject: [PATCH 2/4] fixup! Restore conmon permissions in teardown() Signed-off-by: Ed Santiago --- test/network.bats | 1 + 1 file changed, 1 insertion(+) diff --git a/test/network.bats b/test/network.bats index 294ef217..dc8143c2 100644 --- a/test/network.bats +++ b/test/network.bats @@ -7,6 +7,7 @@ function teardown() { cleanup_pods stop_crio rm -f /var/lib/cni/networks/crionet_test_args/* + chmod 0755 $CONMON_BINARY cleanup_test } From f8e583fca133ad1c5dcead9d03720d34db142a61 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Mon, 30 Oct 2017 11:59:17 +0100 Subject: [PATCH 3/4] Makefile: output binaries under bin/ Signed-off-by: Antonio Murdaca --- .gitignore | 6 +----- Makefile | 32 ++++++++++++++++++-------------- conmon/Makefile | 4 ++-- pause/Makefile | 6 +++--- test/helpers.bash | 10 +++++----- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index f9c8e7d9..ee43c42d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,13 @@ /.artifacts/ /_output/ -/conmon/conmon /conmon/conmon.o /docs/*.[158] /docs/*.[158].gz -/kpod -/crioctl -/crio /crio.conf *.o *.orig -/pause/pause /pause/pause.o +/bin/ /test/bin2img/bin2img /test/checkseccomp/checkseccomp /test/copyimg/copyimg diff --git a/Makefile b/Makefile index a7f86f89..24bf0e2b 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,10 @@ GOPKGBASEDIR := $(shell dirname "$(GOPKGDIR)") # Update VPATH so make finds .gopathok VPATH := $(VPATH):$(GOPATH) SHRINKFLAGS := -s -w -LDFLAGS := -ldflags '${SHRINKFLAGS} -X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO} -X main.kpodVersion=${KPOD_VERSION}' +BASE_LDFLAGS := ${SHRINKFLAGS} -X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO} +KPOD_LDFLAGS := -X main.kpodVersion=${KPOD_VERSION} +LDFLAGS := -ldflags '${BASE_LDFLAGS}' +LDFLAGS_KPOD := -ldflags '${BASE_LDFLAGS} ${KPOD_LDFLAGS}' all: binaries crio.conf docs @@ -46,7 +49,7 @@ help: @echo "Usage: make " @echo @echo " * 'install' - Install binaries to system locations" - @echo " * 'binaries' - Build crio, conmon and crioctl" + @echo " * 'binaries' - Build crio, conmon, pause, crioctl and kpod" @echo " * 'integration' - Execute integration tests" @echo " * 'clean' - Clean artifacts" @echo " * 'lint' - Execute the source code linter" @@ -82,16 +85,16 @@ test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go) $(GO) build $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/checkseccomp crio: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/crio $(PROJECT)) - $(GO) build $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/cmd/crio + $(GO) build $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o bin/$@ $(PROJECT)/cmd/crio crioctl: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/crioctl $(PROJECT)) - $(GO) build $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/cmd/crioctl + $(GO) build $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o bin/$@ $(PROJECT)/cmd/crioctl kpod: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/kpod $(PROJECT)) - $(GO) build $(LDFLAGS) -tags "$(BUILDTAGS)" -o $@ $(PROJECT)/cmd/kpod + $(GO) build $(LDFLAGS_KPOD) -tags "$(BUILDTAGS)" -o bin/$@ $(PROJECT)/cmd/kpod crio.conf: crio - ./crio --config="" config --default > crio.conf + ./bin/crio --config="" config --default > crio.conf clean: ifneq ($(GOPATH),) @@ -102,7 +105,7 @@ endif rm -fr test/testdata/redis-image find . -name \*~ -delete find . -name \#\* -delete - rm -f crioctl crio kpod + rm -f bin/crioctl bin/crio bin/kpod make -C conmon clean make -C pause clean rm -f test/bin2img/bin2img @@ -121,10 +124,11 @@ integration: crioimage testunit: $(GO) test -tags "$(BUILDTAGS)" -cover $(PACKAGES) -localintegration: clean binaries +localintegration: clean binaries test-binaries ./test/test_runner.sh ${TESTFLAGS} -binaries: crio crioctl kpod conmon pause test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp +binaries: crio conmon pause kpod crioctl +test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp MANPAGES_MD := $(wildcard docs/*.md) MANPAGES := $(MANPAGES_MD:%.md=%) @@ -143,11 +147,11 @@ docs: $(MANPAGES) install: .gopathok install.bin install.man install.bin: - install ${SELINUXOPT} -D -m 755 crio $(BINDIR)/crio - install ${SELINUXOPT} -D -m 755 crioctl $(BINDIR)/crioctl - install ${SELINUXOPT} -D -m 755 kpod $(BINDIR)/kpod - install ${SELINUXOPT} -D -m 755 conmon/conmon $(LIBEXECDIR)/crio/conmon - install ${SELINUXOPT} -D -m 755 pause/pause $(LIBEXECDIR)/crio/pause + install ${SELINUXOPT} -D -m 755 bin/crio $(BINDIR)/crio + install ${SELINUXOPT} -D -m 755 bin/crioctl $(BINDIR)/crioctl + install ${SELINUXOPT} -D -m 755 bin/kpod $(BINDIR)/kpod + install ${SELINUXOPT} -D -m 755 bin/conmon $(LIBEXECDIR)/crio/conmon + install ${SELINUXOPT} -D -m 755 bin/pause $(LIBEXECDIR)/crio/pause install.man: install ${SELINUXOPT} -d -m 755 $(MANDIR)/man1 diff --git a/conmon/Makefile b/conmon/Makefile index 460c1faa..b75605d9 100644 --- a/conmon/Makefile +++ b/conmon/Makefile @@ -5,8 +5,8 @@ override LIBS += $(shell pkg-config --libs glib-2.0) override CFLAGS += -std=c99 -Os -Wall -Wextra $(shell pkg-config --cflags glib-2.0) conmon: $(obj) - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + $(CC) -o ../bin/$@ $^ $(CFLAGS) $(LIBS) .PHONY: clean clean: - rm -f $(obj) conmon + rm -f $(obj) ../bin/conmon diff --git a/pause/Makefile b/pause/Makefile index da24f7fe..f0951af7 100644 --- a/pause/Makefile +++ b/pause/Makefile @@ -5,9 +5,9 @@ override LIBS += override CFLAGS += -std=c99 -Os -Wall -Wextra -static pause: $(obj) - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - strip $@ + $(CC) -o ../bin/$@ $^ $(CFLAGS) $(LIBS) + strip ../bin/$@ .PHONY: clean clean: - rm -f $(obj) pause + rm -f $(obj) ../bin/pause diff --git a/test/helpers.bash b/test/helpers.bash index 03079865..409ea74b 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -10,16 +10,16 @@ TESTDATA="${INTEGRATION_ROOT}/testdata" CRIO_ROOT=${CRIO_ROOT:-$(cd "$INTEGRATION_ROOT/../.."; pwd -P)} # Path of the crio binary. -CRIO_BINARY=${CRIO_BINARY:-${CRIO_ROOT}/cri-o/crio} +CRIO_BINARY=${CRIO_BINARY:-${CRIO_ROOT}/cri-o/bin/crio} # Path of the crictl binary. CRICTL_PATH=$(command -v crictl || true) CRICTL_BINARY=${CRICTL_PATH:-/usr/bin/crictl} # Path to kpod binary. -KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/cri-o/kpod} +KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/cri-o/bin/kpod} # Path of the conmon binary. -CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/cri-o/conmon/conmon} +CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/cri-o/bin/conmon} # Path of the pause binary. -PAUSE_BINARY=${PAUSE_BINARY:-${CRIO_ROOT}/cri-o/pause/pause} +PAUSE_BINARY=${PAUSE_BINARY:-${CRIO_ROOT}/cri-o/bin/pause} # Path of the default seccomp profile. SECCOMP_PROFILE=${SECCOMP_PROFILE:-${CRIO_ROOT}/cri-o/seccomp.json} # Name of the default apparmor profile. @@ -174,7 +174,7 @@ function crio() { } # DEPRECATED -OCIC_BINARY=${OCIC_BINARY:-${CRIO_ROOT}/cri-o/crioctl} +OCIC_BINARY=${OCIC_BINARY:-${CRIO_ROOT}/cri-o/bin/crioctl} # Run crioctl using the binary specified by $OCIC_BINARY. function crioctl() { "$OCIC_BINARY" --connect "$CRIO_SOCKET" "$@" From 1ac7da151be7483d4175cc0c956ee45a1543ab49 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 17 Oct 2017 09:02:20 -0600 Subject: [PATCH 4/4] restore lost cni-plugin option Commit d5b5028c undid part of my pr#953 (cni plugin path). Restore it. Signed-off-by: Ed Santiago --- test/helpers.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers.bash b/test/helpers.bash index 409ea74b..9c6d8d91 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -244,7 +244,7 @@ function start_crio() { "$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTS --runroot "$TESTDIR/crio-run" --image-name=mrunalp/image-volume-test --import-from=dir:"$ARTIFACTS_PATH"/image-volume-test-image --add-name=docker.io/library/mrunalp/image-volume-test --signature-policy="$INTEGRATION_ROOT"/policy.json "$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTS --runroot "$TESTDIR/crio-run" --image-name=busybox:latest --import-from=dir:"$ARTIFACTS_PATH"/busybox-image --add-name=docker.io/library/busybox:latest --signature-policy="$INTEGRATION_ROOT"/policy.json "$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTS --runroot "$TESTDIR/crio-run" --image-name=runcom/stderr-test:latest --import-from=dir:"$ARTIFACTS_PATH"/stderr-test --add-name=docker.io/runcom/stderr-test:latest --signature-policy="$INTEGRATION_ROOT"/policy.json - "$CRIO_BINARY" ${DEFAULT_MOUNTS_OPTS} ${HOOKS_OPTS} --conmon "$CONMON_BINARY" --listen "$CRIO_SOCKET" --cgroup-manager "$CGROUP_MANAGER" --registry "docker.io" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/crio" --runroot "$TESTDIR/crio-run" $STORAGE_OPTS --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$CRIO_CNI_CONFIG" --signature-policy "$INTEGRATION_ROOT"/policy.json --image-volumes "$IMAGE_VOLUMES" --pids-limit "$PIDS_LIMIT" --log-size-max "$LOG_SIZE_MAX_LIMIT" --config /dev/null config >$CRIO_CONFIG + "$CRIO_BINARY" ${DEFAULT_MOUNTS_OPTS} ${HOOKS_OPTS} --conmon "$CONMON_BINARY" --listen "$CRIO_SOCKET" --cgroup-manager "$CGROUP_MANAGER" --registry "docker.io" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/crio" --runroot "$TESTDIR/crio-run" $STORAGE_OPTS --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$CRIO_CNI_CONFIG" --cni-plugin-dir "$CRIO_CNI_PLUGIN" --signature-policy "$INTEGRATION_ROOT"/policy.json --image-volumes "$IMAGE_VOLUMES" --pids-limit "$PIDS_LIMIT" --log-size-max "$LOG_SIZE_MAX_LIMIT" --config /dev/null config >$CRIO_CONFIG # Prepare the CNI configuration files, we're running with non host networking by default if [[ -n "$4" ]]; then