[lxc-devel] [crio-lxc/master] Some fixups

tych0 on Github lxc-bot at linuxcontainers.org
Wed Jan 22 02:38:38 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 304 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200121/de1a7575/attachment.bin>
-------------- next part --------------
From dfe43bfd11d76bce4ae95369234b8d909e9eb4e6 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho at tycho.ws>
Date: Tue, 21 Jan 2020 19:12:24 -0700
Subject: [PATCH 1/5] tests: s/plugin_dir/plugin_dirs

edb959068e324a8dcde6b8b47ce1582b8434ac3d changes the type of plugin_dir to
a string, and adds plugin_dirs. Although it claims to maintain backwards
compatibility, we get this error with our old config:

unable to decode configuration /home/tycho/packages/crio-lxc/crio-lxc-test.8zl3anTi/crio.conf: toml: cannot load TOML value of type string into a Go slice

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 test/crio.conf.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/crio.conf.in b/test/crio.conf.in
index 26c6963..69fd1a8 100644
--- a/test/crio.conf.in
+++ b/test/crio.conf.in
@@ -267,6 +267,6 @@ registries = [
 network_dir = "CRIOLXC_TEST_DIR/cni/net.d"
 
 # Paths to directories where CNI plugin binaries are located.
-plugin_dir = [
+plugin_dirs = [
 	"CRIOLXC_TEST_DIR/cni-plugins/bin",
 ]

From 7468640d553020e5138ab455c86e8c36dad00468 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho at tycho.ws>
Date: Tue, 21 Jan 2020 19:15:05 -0700
Subject: [PATCH 2/5] go.mod: add a go 1.13 directive

This is stupid, but go 1.13 adds it automatically if it's not present, so
let's do this to avoid everyone's tree being dirty when they do a build.

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 go.mod | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/go.mod b/go.mod
index d1bda7c..7f80ccc 100644
--- a/go.mod
+++ b/go.mod
@@ -21,3 +21,5 @@ require (
 replace github.com/vbatts/go-mtree v0.4.4 => github.com/vbatts/go-mtree v0.4.5-0.20190122034725-8b6de6073c1a
 
 replace github.com/openSUSE/umoci v0.4.4 => github.com/tych0/umoci v0.1.1-0.20190402232331-556620754fb1
+
+go 1.13

From efd21abec0b566030156b4bfe8c0be4d621d1178 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho at tycho.ws>
Date: Tue, 21 Jan 2020 19:17:33 -0700
Subject: [PATCH 3/5] readme: make it clear you can put crictl somewhere else

At least make the copy pastable example /usr/local

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 5d01c66..fbce9fd 100644
--- a/README.md
+++ b/README.md
@@ -38,12 +38,12 @@ cd cni-plugins
 ```
 
 You'll also need crictl.  Download the tarball, extract it, and
-copy crictl to /usr/bin:
+copy crictl to somewhere in your path:
 
 ```
 wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.14.0/crictl-v1.14.0-linux-amd64.tar.gz
 tar zxf crictl-v1.14.0-linux-amd64.tar.gz
-sudo cp crictl /usr/bin
+sudo cp crictl /usr/local/bin # or ~/.local/bin, etc.
 ```
 
 You'll also need conntrack installed:

From a7ac544981e5c16bc8460de536d881c582b6570e Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho at tycho.ws>
Date: Tue, 21 Jan 2020 19:25:58 -0700
Subject: [PATCH 4/5] test: switch CRIO_REPO to PACKAGES_DIR

conmon is now shipped in a separate package, so we need to build that too.

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 Makefile          | 4 ++--
 test/crio.conf.in | 2 +-
 test/helpers.bash | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 86a92d7..e92cbd1 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ GO_SRC=$(shell find . -name \*.go)
 COMMIT_HASH=$(shell git rev-parse HEAD)
 COMMIT=$(if $(shell git status --porcelain --untracked-files=no),$(COMMIT_HASH)-dirty,$(COMMIT_HASH))
 TEST?=$(patsubst test/%.bats,%,$(wildcard test/*.bats))
-CRIO_REPO?=~/packages/cri-o
+PACKAGES_DIR?=~/packages
 
 crio-lxc: $(GO_SRC)
 	go build -ldflags "-X main.version=$(COMMIT)" -o crio-lxc ./cmd
@@ -12,7 +12,7 @@ crio-lxc: $(GO_SRC)
 check: crio-lxc
 	go fmt ./... && ([ -z $(TRAVIS) ] || git diff --quiet)
 	go test ./...
-	CRIO_REPO=$(CRIO_REPO) sudo -E "PATH=$$PATH" bats -t $(patsubst %,test/%.bats,$(TEST))
+	PACKAGES_DIR=$(PACKAGES_DIR) sudo -E "PATH=$$PATH" bats -t $(patsubst %,test/%.bats,$(TEST))
 
 .PHONY: vendorup
 vendorup:
diff --git a/test/crio.conf.in b/test/crio.conf.in
index 69fd1a8..e57e7e7 100644
--- a/test/crio.conf.in
+++ b/test/crio.conf.in
@@ -87,7 +87,7 @@ default_runtime = "runc"
 no_pivot = false
 
 # Path to the conmon binary, used for monitoring the OCI runtime.
-conmon = "CRIO_REPO/bin/conmon"
+conmon = "PACKAGES_DIR/conmon/bin/conmon"
 
 # Environment variable list for the conmon process, used for passing necessary
 # environment variables to conmon or the runtime.
diff --git a/test/helpers.bash b/test/helpers.bash
index 1741ea1..a6e2cf7 100644
--- a/test/helpers.bash
+++ b/test/helpers.bash
@@ -12,7 +12,7 @@ function setup_crio {
     sed \
         -e "s,CRIOLXC_TEST_DIR,$TEMP_DIR,g" \
         -e "s,CRIOLXC_BINARY,$ROOT_DIR/crio-lxc,g" \
-        -e "s,CRIO_REPO,$CRIO_REPO,g" \
+        -e "s,PACKAGES_DIR,$PACKAGES_DIR,g" \
         "$ROOT_DIR/test/crio.conf.in" > "$TEMP_DIR/crio.conf"
     # it doesn't like seccomp_profile = "", so let's make a bogus one
     echo "{}" > "$TEMP_DIR/seccomp.json"
@@ -34,7 +34,7 @@ EOF
     fi
     # set up an insecure policy
     echo '{"default": [{"type": "insecureAcceptAnything"}]}' > "$TEMP_DIR/policy.json"
-    "$CRIO_REPO/bin/crio" --config "$TEMP_DIR/crio.conf" &
+    "$PACKAGES_DIR/cri-o/bin/crio" --config "$TEMP_DIR/crio.conf" &
     declare -g CRIO_PID=$!
 }
 

From dc579393e93e069aede27c36973b51387223f7cc Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho at tycho.ws>
Date: Tue, 21 Jan 2020 19:27:55 -0700
Subject: [PATCH 5/5] tests: crio requires pinns

There's a new executable that needs to be configured called pinns. Let's
configure it. (I don't know what it does.)

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 test/crio.conf.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/crio.conf.in b/test/crio.conf.in
index e57e7e7..eb0c7f8 100644
--- a/test/crio.conf.in
+++ b/test/crio.conf.in
@@ -89,6 +89,9 @@ no_pivot = false
 # Path to the conmon binary, used for monitoring the OCI runtime.
 conmon = "PACKAGES_DIR/conmon/bin/conmon"
 
+# Path to pinns.
+pinns_path = "PACKAGES_DIR/cri-o/bin/pinns"
+
 # Environment variable list for the conmon process, used for passing necessary
 # environment variables to conmon or the runtime.
 conmon_env = [


More information about the lxc-devel mailing list