From eb5dd76e9da1331aecce409d956a2520a6e08a78 Mon Sep 17 00:00:00 2001 From: Jakob Naucke Date: Fri, 15 Oct 2021 16:13:44 +0200 Subject: [PATCH] osbuilder: Re-enable building the agent in Docker or Podman. This is a partial revert of 76c18aa3454ee7acdc6870b779d617ae26fdced8. The rationale behind that commit was the fact that the agent could not be built on Alpine, and then this capability was removed altogether. The issue in Alpine has since been resolved (see https://github.com/kata-containers/osbuilder/issues/386). At the same time, this ensures being able to run a glibc agent on hosts with distros more recent than the osbuilder distro used (i.e. as of now, when you build the agent on the host, and its glibc is newer than the one used in the guest, the agent may encounter unresolved symbols). Fixes #2398 Signed-off-by: Jakob Naucke --- .../rootfs-builder/alpine/Dockerfile.in | 24 +++++++++++++++---- tools/osbuilder/rootfs-builder/rootfs.sh | 9 ++++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in b/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in index 0f9e66e45e..4da311aa06 100644 --- a/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in +++ b/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in @@ -7,7 +7,23 @@ ARG IMAGE_REGISTRY=docker.io FROM ${IMAGE_REGISTRY}/alpine:3.13.5 RUN apk update && apk add \ - bash \ - curl \ - coreutils \ - binutils + apk-tools-static \ + autoconf \ + automake \ + bash \ + binutils \ + cmake \ + coreutils \ + curl \ + g++ \ + gcc \ + git \ + libc-dev \ + libseccomp \ + libseccomp-dev \ + linux-headers \ + m4 \ + make \ + musl \ + musl-dev \ + tar diff --git a/tools/osbuilder/rootfs-builder/rootfs.sh b/tools/osbuilder/rootfs-builder/rootfs.sh index 44fdab42ea..5c0a126346 100755 --- a/tools/osbuilder/rootfs-builder/rootfs.sh +++ b/tools/osbuilder/rootfs-builder/rootfs.sh @@ -420,7 +420,6 @@ build_rootfs_distro() --env INSIDE_CONTAINER=1 \ --env SECCOMP="${SECCOMP}" \ --env DEBUG="${DEBUG}" \ - --env STAGE_PREPARE_ROOTFS=1 \ --env HOME="/root" \ -v "${repo_dir}":"/kata-containers" \ -v "${ROOTFS_DIR}":"/rootfs" \ @@ -429,6 +428,8 @@ build_rootfs_distro() $docker_run_args \ ${image_name} \ bash /kata-containers/tools/osbuilder/rootfs-builder/rootfs.sh "${distro}" + + exit $? fi } @@ -649,10 +650,8 @@ main() prepare_overlay fi - if [ "$STAGE_PREPARE_ROOTFS" == "" ]; then - init="${ROOTFS_DIR}/sbin/init" - setup_rootfs - fi + init="${ROOTFS_DIR}/sbin/init" + setup_rootfs } main $*