From 33dc19f82a272a86b89a54ed418577974d21e913 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Wed, 23 Jan 2019 09:05:14 -0600 Subject: [PATCH 1/7] snap: get sources from git repositories get source from git repositories to show the right commit version of each component. fixes #317 Signed-off-by: Julio Montes --- snap/snapcraft.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 33d988aec..a391cf634 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -43,8 +43,7 @@ parts: mkdir -p ${pkg_gopath} # download source - curl -LO https://github.com/kata-containers/${pkg_name}/archive/${SNAPCRAFT_PROJECT_VERSION}.tar.gz - tar -xf ${SNAPCRAFT_PROJECT_VERSION}.tar.gz --strip-components=1 -C ${pkg_gopath} + git clone -b ${SNAPCRAFT_PROJECT_VERSION} https://github.com/kata-containers/${pkg_name} ${pkg_gopath} cd ${pkg_gopath} # build and install @@ -76,8 +75,7 @@ parts: mkdir -p ${pkg_gopath} # download source - curl -LO https://github.com/kata-containers/${pkg_name}/archive/${SNAPCRAFT_PROJECT_VERSION}.tar.gz - tar -xf ${SNAPCRAFT_PROJECT_VERSION}.tar.gz --strip-components=1 -C ${pkg_gopath} + git clone -b ${SNAPCRAFT_PROJECT_VERSION} https://github.com/kata-containers/${pkg_name} ${pkg_gopath} cd ${pkg_gopath} # build and install @@ -100,8 +98,7 @@ parts: mkdir -p ${pkg_gopath} # download source - curl -LO https://github.com/kata-containers/${pkg_name}/archive/${SNAPCRAFT_PROJECT_VERSION}.tar.gz - tar -xf ${SNAPCRAFT_PROJECT_VERSION}.tar.gz --strip-components=1 -C ${pkg_gopath} + git clone -b ${SNAPCRAFT_PROJECT_VERSION} https://github.com/kata-containers/${pkg_name} ${pkg_gopath} cd ${pkg_gopath} # build and install @@ -156,8 +153,7 @@ parts: mkdir -p ${pkg_gopath} # download source - curl -LO https://github.com/kata-containers/${pkg_name}/archive/${SNAPCRAFT_PROJECT_VERSION}.tar.gz - tar -xf ${SNAPCRAFT_PROJECT_VERSION}.tar.gz --strip-components=1 -C ${pkg_gopath} + git clone -b ${SNAPCRAFT_PROJECT_VERSION} https://github.com/kata-containers/${pkg_name} ${pkg_gopath} cd ${pkg_gopath} # build and install From 526c5ffd76fd104c472faa8b2e039b7838297f96 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Fri, 25 Jan 2019 07:38:23 -0600 Subject: [PATCH 2/7] snap: fix qemu command name set qemu-system instead of qemu-lite as default qemu command Signed-off-by: Julio Montes --- snap/snapcraft.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a391cf634..345e829c7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -49,11 +49,13 @@ parts: # build and install make \ PREFIX=/snap/${SNAPCRAFT_PROJECT_NAME}/current/usr \ - SKIP_GO_VERSION_CHECK=1 + SKIP_GO_VERSION_CHECK=1 \ + QEMUCMD=qemu-system-$(arch) make install \ PREFIX=/usr \ DESTDIR=${SNAPCRAFT_PART_INSTALL} \ - SKIP_GO_VERSION_CHECK=1 + SKIP_GO_VERSION_CHECK=1 \ + QEMUCMD=qemu-system-$(arch) # A snap is read-only squashfs, unfourtunately it's not possible to use the rootfs image with DAX # since rw access is required therefore initrd image must be used instead. From 7c25b606ba43985c2cdb9118118651ae0b52b79c Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Fri, 25 Jan 2019 07:50:36 -0600 Subject: [PATCH 3/7] snap: apply patch in runtime to fix DESTDIR This is a hotfix to fix https://github.com/kata-containers/runtime/pull/1162 Signed-off-by: Julio Montes --- snap/1162-runtime.patch | 27 +++++++++++++++++++++++++++ snap/snapcraft.yaml | 4 ++++ 2 files changed, 31 insertions(+) create mode 100644 snap/1162-runtime.patch diff --git a/snap/1162-runtime.patch b/snap/1162-runtime.patch new file mode 100644 index 000000000..be87ee705 --- /dev/null +++ b/snap/1162-runtime.patch @@ -0,0 +1,27 @@ +diff --git a/Makefile b/Makefile +index 1c11f74..9c4709b 100644 +--- a/Makefile ++++ b/Makefile +@@ -248,11 +248,11 @@ ifeq (,$(findstring $(DEFAULT_HYPERVISOR),$(KNOWN_HYPERVISORS))) + endif + + ifeq ($(DEFAULT_HYPERVISOR),$(HYPERVISOR_QEMU)) +- DEFAULT_HYPERVISOR_CONFIG_PATH = $(CONFIG_PATH_QEMU) ++ DEFAULT_HYPERVISOR_CONFIG_FILE = $(CONFIG_FILE_QEMU) + endif + + ifeq ($(DEFAULT_HYPERVISOR),$(HYPERVISOR_FC)) +- DEFAULT_HYPERVISOR_CONFIG_PATH = $(CONFIG_PATH_FC) ++ DEFAULT_HYPERVISOR_CONFIG_FILE = $(CONFIG_FILE_FC) + endif + + CONFDIR := $(DEFAULTSDIR)/$(PROJECT_DIR) +@@ -546,7 +546,7 @@ install-bin-libexec: $(BINLIBEXECLIST) + + install-configs: $(CONFIGS) + $(QUIET_INST)$(foreach f,$(CONFIGS),$(call INSTALL_CONFIG,$f,$(dir $(CONFIG_PATH)))) +- $(QUIET_INST)ln -sf $(DEFAULT_HYPERVISOR_CONFIG_PATH) $(CONFIG_PATH) ++ $(QUIET_INST)(cd $(dir $(DESTDIR)/$(CONFIG_PATH)) && ln -sf $(DEFAULT_HYPERVISOR_CONFIG_FILE) $(CONFIG_FILE)) + + install-scripts: $(SCRIPTS) + $(QUIET_INST)$(foreach f,$(SCRIPTS),$(call INSTALL_EXEC,$f,$(SCRIPTS_DIR))) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 345e829c7..a9c7d2162 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -33,6 +33,7 @@ parts: build-attributes: [no-patchelf] override-build: | pkg_name=runtime + patch1="$(realpath ../../../snap/1162-runtime.patch)" # set GOPATH export GOPATH=$(realpath go) @@ -46,6 +47,9 @@ parts: git clone -b ${SNAPCRAFT_PROJECT_VERSION} https://github.com/kata-containers/${pkg_name} ${pkg_gopath} cd ${pkg_gopath} + #Issue: https://github.com/kata-containers/runtime/pull/1162 + patch -p1 < "${patch1}" + # build and install make \ PREFIX=/snap/${SNAPCRAFT_PROJECT_NAME}/current/usr \ From 7d77ae9ca82d6bf53ed2b64bfd3cdbeca709c2b3 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Mon, 28 Jan 2019 09:15:36 -0600 Subject: [PATCH 4/7] snap: apply patch in runtime to fix config paths This is a hotfix to fix https://github.com/kata-containers/runtime/issues/1185 Signed-off-by: Julio Montes --- snap/1185-runtime.patch | 22 ++++++++++++++++++++++ snap/snapcraft.yaml | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 snap/1185-runtime.patch diff --git a/snap/1185-runtime.patch b/snap/1185-runtime.patch new file mode 100644 index 000000000..a256ed107 --- /dev/null +++ b/snap/1185-runtime.patch @@ -0,0 +1,22 @@ +diff --git a/cli/main.go b/cli/main.go +index a01a02dc5..a021a0a77 100644 +--- a/cli/main.go ++++ b/cli/main.go +@@ -250,6 +250,8 @@ func beforeSubcommands(c *cli.Context) error { + var runtimeConfig oci.RuntimeConfig + var err error + ++ katautils.SetConfigOptions(name, defaultRuntimeConfiguration, defaultSysConfRuntimeConfiguration) ++ + handleShowConfig(c) + + if userWantsUsage(c) || (c.NArg() == 1 && (c.Args()[0] == checkCmd)) { +@@ -302,8 +304,6 @@ func beforeSubcommands(c *cli.Context) error { + ignoreLogging = true + } + +- katautils.SetConfigOptions(name, defaultRuntimeConfiguration, defaultSysConfRuntimeConfiguration) +- + configFile, runtimeConfig, err = katautils.LoadConfiguration(c.GlobalString(configFilePathOption), ignoreLogging, false) + if err != nil { + fatal(err) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a9c7d2162..9dd170653 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -34,6 +34,7 @@ parts: override-build: | pkg_name=runtime patch1="$(realpath ../../../snap/1162-runtime.patch)" + patch2="$(realpath ../../../snap/1185-runtime.patch)" # set GOPATH export GOPATH=$(realpath go) @@ -49,6 +50,8 @@ parts: #Issue: https://github.com/kata-containers/runtime/pull/1162 patch -p1 < "${patch1}" + #Issue: https://github.com/kata-containers/runtime/issues/1185 + patch -p1 < "${patch2}" # build and install make \ From e5940ce66d46eac5b15a9fa27b1c110935070949 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Mon, 28 Jan 2019 09:16:47 -0600 Subject: [PATCH 5/7] snap: remove commands used for debugging remove set and env commands that were used for debugging Signed-off-by: Julio Montes --- snap/snapcraft.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 9dd170653..af6e0aaae 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -123,11 +123,9 @@ parts: - docker.io - cpio override-build: | - set -x # go was built in parts/go/build export GOROOT=$(realpath ../../go/build) export PATH="${GOROOT}/bin:${PATH}" - env if [ -n "$http_proxy" ]; then echo "Setting proxy $http_proxy" systemctl set-environment http_proxy=$http_proxy || true From 7684c8e29af090a48d3e66bd36415e216b5d0352 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Mon, 28 Jan 2019 09:22:15 -0600 Subject: [PATCH 6/7] snap: use new GOPATH to build image Use a new GOPATH to build image in order to avoid clashes with user's GOPATH, otherwise user's kata agent will be used causing problem if that repository is not up to date. Signed-off-by: Julio Montes --- snap/snapcraft.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index af6e0aaae..66a4bb689 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -123,6 +123,9 @@ parts: - docker.io - cpio override-build: | + # set GOPATH + export GOPATH=$(realpath go) + mkdir -p "${GOPATH}" # go was built in parts/go/build export GOROOT=$(realpath ../../go/build) export PATH="${GOROOT}/bin:${PATH}" @@ -138,7 +141,7 @@ parts: # use the same go version for all packages sed -i 's|^GO_VERSION=.*|GO_VERSION='$(go version | cut -d' ' -f3 | tr -d go)'|g' rootfs-builder/versions.txt - sudo -E PATH=$PATH make DISTRO=alpine AGENT_INIT=yes USE_DOCKER=1 initrd + sudo -E PATH=$PATH make AGENT_VERSION=${SNAPCRAFT_PROJECT_VERSION} DISTRO=alpine AGENT_INIT=yes USE_DOCKER=1 initrd kata_image_dir=${SNAPCRAFT_PART_INSTALL}/usr/share/kata-containers mkdir -p ${kata_image_dir} From 86fca4564ef6bba6cc42f92a28e6c42befd99f15 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Wed, 23 Jan 2019 09:16:12 -0600 Subject: [PATCH 7/7] snap: release 1.5.0 release kata containers 1.5.0 Signed-off-by: Julio Montes --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 66a4bb689..20d0998af 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: kata-containers -version: "1.5.0-rc2" +version: "1.5.0" summary: Build lightweight VMs that seamlessly plug into the containers ecosystem description: | Kata Containers is an open source project and community working to build a