kata-containers/osbuilder

Initial build attempt always fails

dcflachs opened this issue · 1 comments

When attempting to build using stable-1.10 and the command sudo make USE_DOCKER=true DEBUG=true DISTRO=ubuntu image the first run always fails quciky with the following errors and i am not sure i understand why.

/tmp/osbuilder # sudo make USE_DOCKER=true DEBUG=true DISTRO=ubuntu clean
rm -rf /tmp/osbuilder/.ubuntu_rootfs.done /tmp/osbuilder/ubuntu_rootfs /tmp/osbuilder/kata-containers.img /tmp/osbuilder/kata-containers-initrd.img
/tmp/osbuilder # sudo make USE_DOCKER=true DEBUG=true DISTRO=ubuntu image
Creating rootfs for ubuntu
/tmp/osbuilder/rootfs-builder/rootfs.sh -o 1.10.1-1987184cf88868abe8294b4982d870b4e4f370c1 -r /tmp/osbuilder/ubuntu_rootfs ubuntu
+ script_name=rootfs.sh
+++ readlink -f /tmp/osbuilder/rootfs-builder/rootfs.sh
++ dirname /tmp/osbuilder/rootfs-builder/rootfs.sh
+ script_dir=/tmp/osbuilder/rootfs-builder
+ AGENT_VERSION=
+ GO_AGENT_PKG=github.com/kata-containers/agent
+ AGENT_BIN=kata-agent
+ AGENT_INIT=no
+ KERNEL_MODULES_DIR=
+ OSBUILDER_VERSION=unknown
+ DOCKER_RUNTIME=runc
+ GO_VERSION=null
+ export GOPATH=/root/go
+ GOPATH=/root/go
+ lib_file=/tmp/osbuilder/rootfs-builder/../scripts/lib.sh
+ source /tmp/osbuilder/rootfs-builder/../scripts/lib.sh
++ set -e
++ GO_AGENT_PKG=github.com/kata-containers/agent
++ GO_RUNTIME_PKG=github.com/kata-containers/runtime
++ KATA_BRANCH=
++ KATA_BRANCH=master
++ yq_file=/tmp/osbuilder/rootfs-builder/../scripts/install-yq.sh
+ trap 'handle_error $LINENO' ERR
++ uname -m
+ ARCH=x86_64
+ typeset -r CONFIG_SH=config.sh
+ typeset -r CONFIG_ARCH_SH=config_x86_64.sh
+ typeset -r LIB_SH=rootfs_lib.sh
+ typeset distro=
+ typeset ROOTFS_DIR
+ typeset init=
+ main -o 1.10.1-1987184cf88868abe8294b4982d870b4e4f370c1 -r /tmp/osbuilder/ubuntu_rootfs ubuntu
+ parse_arguments -o 1.10.1-1987184cf88868abe8294b4982d870b4e4f370c1 -r /tmp/osbuilder/ubuntu_rootfs ubuntu
+ getopts a:hlo:r:t: opt
+ case $opt in
+ OSBUILDER_VERSION=1.10.1-1987184cf88868abe8294b4982d870b4e4f370c1
+ getopts a:hlo:r:t: opt
+ case $opt in
+ ROOTFS_DIR=/tmp/osbuilder/ubuntu_rootfs
+ getopts a:hlo:r:t: opt
+ shift 4
+ distro=ubuntu
+ check_env_variables
+ '[' -z /root/go ']'
+ GOPATH_LOCAL=/root/go
+ '[' no == yes -o no == no ']'
+ '[' -n '' ']'
+ '[' -n 1.10.1-1987184cf88868abe8294b4982d870b4e4f370c1 ']'
+ init=/tmp/osbuilder/ubuntu_rootfs/sbin/init
+ '[' -n ubuntu ']'
+ build_rootfs_distro
+ '[' -n ubuntu ']'
+ distro_config_dir=/tmp/osbuilder/rootfs-builder/ubuntu
+ rootfs_config=/tmp/osbuilder/rootfs-builder/ubuntu/config.sh
+ source /tmp/osbuilder/rootfs-builder/ubuntu/config.sh
++ OS_VERSION=18.04
++ OS_NAME=bionic
++ PACKAGES='systemd iptables init chrony kmod'
++ DEBOOTSTRAP=debootstrap
++ case $(uname -m) in
+++ uname -m
++ ARCHITECTURE=amd64
++ INIT_PROCESS=systemd
++ ARCH_EXCLUDE_LIST=()
++ '[' '' = yes ']'
++ true
+ rootfs_arch_config=/tmp/osbuilder/rootfs-builder/ubuntu/config_x86_64.sh
+ '[' -f /tmp/osbuilder/rootfs-builder/ubuntu/config_x86_64.sh ']'
+ '[' -d /tmp/osbuilder/rootfs-builder/ubuntu ']'
+ '[' -z /tmp/osbuilder/ubuntu_rootfs ']'
+ '[' -e /tmp/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh ']'
+ rootfs_lib=/tmp/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh
+ info 'rootfs_lib.sh file found. Loading content'
+ local 'msg=rootfs_lib.sh file found. Loading content'
+ echo 'INFO: rootfs_lib.sh file found. Loading content'
INFO: rootfs_lib.sh file found. Loading content
+ source /tmp/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh
+ CONFIG_DIR=/tmp/osbuilder/rootfs-builder/ubuntu
+ check_function_exist build_rootfs
+ function_name=build_rootfs
++ type -t build_rootfs
+ '[' function == function ']'
+ '[' -z '' ']'
+ trap error_handler ERR
+ mkdir -p /tmp/osbuilder/ubuntu_rootfs
+ detect_go_version
+ info 'Detecting agent go version'
+ local 'msg=Detecting agent go version'
+ echo 'INFO: Detecting agent go version'
INFO: Detecting agent go version
++ command -v yq
++ command -v /root/go/bin/yq
+ typeset -r yq=
+ '[' -z '' ']'
+ source /tmp/osbuilder/rootfs-builder/../scripts/install-yq.sh
++ install_yq
++ GOPATH=/root/go
++ local yq_path=/root/go/bin/yq
++ local yq_pkg=github.com/mikefarah/yq
++ '[' -x /root/go/bin/yq ']'
++ read -r -a sysInfo
+++ uname -sm
++ case "${sysInfo[0]}" in
++ goos=linux
++ case "${sysInfo[1]}" in
++ goarch=amd64
++ mkdir -p /root/go/bin
++ command -v curl
++ local yq_version=2.3.0
++ local yq_url=https://github.com/mikefarah/yq/releases/download/2.3.0/yq_linux_amd64
++ curl -o /root/go/bin/yq -LSsf https://github.com/mikefarah/yq/releases/download/2.3.0/yq_linux_amd64
++ '[' 0 -ne 0 ']'
++ chmod +x /root/go/bin/yq
++ command -v /root/go/bin/yq
+ local runtimeRevision=
+ local runtime_version_url=https://raw.githubusercontent.com/kata-containers/agent/master/VERSION
+ info 'Detecting runtime version using https://raw.githubusercontent.com/kata-containers/agent/master/VERSION'
+ local 'msg=Detecting runtime version using https://raw.githubusercontent.com/kata-containers/agent/master/VERSION'
+ echo 'INFO: Detecting runtime version using https://raw.githubusercontent.com/kata-containers/agent/master/VERSION'
INFO: Detecting runtime version using https://raw.githubusercontent.com/kata-containers/agent/master/VERSION
++ curl -fsSL https://raw.githubusercontent.com/kata-containers/agent/master/VERSION
+ runtimeRevision=1.11.0-alpha0
+ '[' -n 1.11.0-alpha0 ']'
+ typeset -r runtimeVersionsURL=https://raw.githubusercontent.com/kata-containers/runtime/1.11.0-alpha0/versions.yaml
+ info 'Getting golang version from https://raw.githubusercontent.com/kata-containers/runtime/1.11.0-alpha0/versions.yaml'
+ local 'msg=Getting golang version from https://raw.githubusercontent.com/kata-containers/runtime/1.11.0-alpha0/versions.yaml'
+ echo 'INFO: Getting golang version from https://raw.githubusercontent.com/kata-containers/runtime/1.11.0-alpha0/versions.yaml'
INFO: Getting golang version from https://raw.githubusercontent.com/kata-containers/runtime/1.11.0-alpha0/versions.yaml
++ curl -fsSL https://raw.githubusercontent.com/kata-containers/runtime/1.11.0-alpha0/versions.yaml
++ tac
++ tac
++ r - languages.golang.version
/tmp/osbuilder/rootfs-builder/../scripts/lib.sh: line 292: r: command not found
+ GO_VERSION=
+ info 'Agent version has not match with a runtime version, assumming it is a PR'
+ local 'msg=Agent version has not match with a runtime version, assumming it is a PR'
+ echo 'INFO: Agent version has not match with a runtime version, assumming it is a PR'
INFO: Agent version has not match with a runtime version, assumming it is a PR
+ local kata_runtime_pkg_dir=/root/go/src/github.com/kata-containers/runtime
+ '[' '!' -d /root/go/src/github.com/kata-containers/runtime ']'
+ info 'There is not runtime repository in filesystem (/root/go/src/github.com/kata-containers/runtime)'
+ local 'msg=There is not runtime repository in filesystem (/root/go/src/github.com/kata-containers/runtime)'
+ echo 'INFO: There is not runtime repository in filesystem (/root/go/src/github.com/kata-containers/runtime)'
INFO: There is not runtime repository in filesystem (/root/go/src/github.com/kata-containers/runtime)
+ local runtime_versions_url=https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml
+ info 'Get versions file from https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml'
+ local 'msg=Get versions file from https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml'
+ echo 'INFO: Get versions file from https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml'
INFO: Get versions file from https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml
++ curl -fsSL https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml
++ tac
++ tac
++ r - languages.golang.version
/tmp/osbuilder/rootfs-builder/../scripts/lib.sh: line 304: r: command not found
+ GO_VERSION=
+ '[' 127 == 0 ']'
+ return 1
+ die 'Could not detect the required Go version for AGENT_VERSION='\''master'\''.'
+ msg='Could not detect the required Go version for AGENT_VERSION='\''master'\''.'
+ echo 'ERROR: Could not detect the required Go version for AGENT_VERSION='\''master'\''.'
ERROR: Could not detect the required Go version for AGENT_VERSION='master'.
+ exit 1
make: *** [Makefile:86: /tmp/osbuilder/.ubuntu_rootfs.done] Error 1

Running the same make command immediately after is runs the build process much farther, seemingly bypassing whatever condition was failing the first run.

@dcflachs thanks, I have raised #430 to fix this