mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 14:43:51 +00:00
agent: detect required Go version from versions.yaml
Detect the Go version required to build the agent from the versions.yaml file in the runtime repository. Fixes: #291 Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
parent
2f22a5681d
commit
92b42c7f6d
@ -20,6 +20,5 @@ clone_tests_repo()
|
|||||||
|
|
||||||
run_static_checks()
|
run_static_checks()
|
||||||
{
|
{
|
||||||
clone_tests_repo
|
|
||||||
bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/osbuilder"
|
bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/osbuilder"
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,13 @@ elif [ "$ID" == ubuntu ];then
|
|||||||
sudo apt-get -qq update
|
sudo apt-get -qq update
|
||||||
sudo apt-get install -y -qq make automake qemu-utils python-pip coreutils moreutils bc
|
sudo apt-get install -y -qq make automake qemu-utils python-pip coreutils moreutils bc
|
||||||
sudo pip install yamllint
|
sudo pip install yamllint
|
||||||
else
|
else
|
||||||
echo "Linux distribution not supported"
|
echo "Linux distribution not supported"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
clone_tests_repo
|
||||||
bash "${cidir}/static-checks.sh"
|
bash "${cidir}/static-checks.sh"
|
||||||
|
# yq needed to correctly parse runtime/versions.yaml
|
||||||
|
make -C ${tests_repo_dir} install-yq
|
||||||
|
|
||||||
|
@ -5,4 +5,14 @@
|
|||||||
|
|
||||||
From golang:@GO_VERSION@-alpine
|
From golang:@GO_VERSION@-alpine
|
||||||
|
|
||||||
RUN apk update && apk add git make bash gcc musl-dev linux-headers apk-tools-static libseccomp libseccomp-dev
|
RUN apk update && apk add \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
bash \
|
||||||
|
gcc \
|
||||||
|
musl-dev \
|
||||||
|
linux-headers \
|
||||||
|
apk-tools-static \
|
||||||
|
libseccomp \
|
||||||
|
libseccomp-dev \
|
||||||
|
curl
|
||||||
|
@ -7,7 +7,15 @@ From centos:@OS_VERSION@
|
|||||||
|
|
||||||
@SET_PROXY@
|
@SET_PROXY@
|
||||||
|
|
||||||
RUN yum -y update && yum install -y git make gcc coreutils libseccomp libseccomp-devel chrony
|
RUN yum -y update && yum install -y \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
gcc \
|
||||||
|
coreutils \
|
||||||
|
libseccomp \
|
||||||
|
libseccomp-devel \
|
||||||
|
chrony \
|
||||||
|
curl
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper golang to build Kata components
|
||||||
@INSTALL_GO@
|
@INSTALL_GO@
|
||||||
|
@ -7,7 +7,16 @@ From fedora:27
|
|||||||
|
|
||||||
@SET_PROXY@
|
@SET_PROXY@
|
||||||
|
|
||||||
RUN dnf -y update && dnf install -y git systemd pkgconfig gcc coreutils libseccomp libseccomp-devel chrony
|
RUN dnf -y update && dnf install -y \
|
||||||
|
git \
|
||||||
|
systemd \
|
||||||
|
pkgconfig \
|
||||||
|
gcc \
|
||||||
|
coreutils \
|
||||||
|
libseccomp \
|
||||||
|
libseccomp-devel \
|
||||||
|
chrony \
|
||||||
|
curl
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper golang to build Kata components
|
||||||
@INSTALL_GO@
|
@INSTALL_GO@
|
||||||
|
@ -7,7 +7,14 @@ FROM euleros:@OS_VERSION@
|
|||||||
|
|
||||||
@SET_PROXY@
|
@SET_PROXY@
|
||||||
|
|
||||||
RUN yum -y update && yum install -y yum git make gcc coreutils chrony
|
RUN yum -y update && yum install -y \
|
||||||
|
yum \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
gcc \
|
||||||
|
coreutils \
|
||||||
|
chrony \
|
||||||
|
curl
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper golang to build Kata components
|
||||||
@INSTALL_GO@
|
@INSTALL_GO@
|
||||||
|
@ -7,7 +7,17 @@ From fedora:@OS_VERSION@
|
|||||||
|
|
||||||
@SET_PROXY@
|
@SET_PROXY@
|
||||||
|
|
||||||
RUN dnf -y update && dnf install -y git redhat-release systemd pkgconfig gcc make libseccomp libseccomp-devel chrony
|
RUN dnf -y update && dnf install -y \
|
||||||
|
git \
|
||||||
|
redhat-release \
|
||||||
|
systemd \
|
||||||
|
pkgconfig \
|
||||||
|
gcc \
|
||||||
|
make \
|
||||||
|
libseccomp \
|
||||||
|
libseccomp-devel \
|
||||||
|
chrony \
|
||||||
|
curl
|
||||||
|
|
||||||
# This will install the proper golang to build Kata components
|
# This will install the proper golang to build Kata components
|
||||||
@INSTALL_GO@
|
@INSTALL_GO@
|
||||||
|
@ -17,6 +17,7 @@ AGENT_INIT=${AGENT_INIT:-no}
|
|||||||
KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""}
|
KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""}
|
||||||
OSBUILDER_VERSION="unknown"
|
OSBUILDER_VERSION="unknown"
|
||||||
DOCKER_RUNTIME=${DOCKER_RUNTIME:-runc}
|
DOCKER_RUNTIME=${DOCKER_RUNTIME:-runc}
|
||||||
|
GO_VERSION=
|
||||||
export GOPATH=${GOPATH:-${HOME}/go}
|
export GOPATH=${GOPATH:-${HOME}/go}
|
||||||
|
|
||||||
lib_file="${script_dir}/../scripts/lib.sh"
|
lib_file="${script_dir}/../scripts/lib.sh"
|
||||||
@ -25,9 +26,6 @@ source "$lib_file"
|
|||||||
# Default architecture
|
# Default architecture
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
# Load default versions for golang and other componets
|
|
||||||
source "${script_dir}/versions.txt"
|
|
||||||
|
|
||||||
# distro-specific config file
|
# distro-specific config file
|
||||||
typeset -r CONFIG_SH="config.sh"
|
typeset -r CONFIG_SH="config.sh"
|
||||||
|
|
||||||
@ -247,6 +245,18 @@ error_handler()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detect_go_version()
|
||||||
|
{
|
||||||
|
typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq)
|
||||||
|
[ -z "$yq" ] && die "'yq' application not found (needed to parsing minimum Go version required)"
|
||||||
|
|
||||||
|
typeset -r runtimeVersion="${AGENT_VERSION:-master}"
|
||||||
|
typeset -r runtimeVersionsURL="https://raw.githubusercontent.com/kata-containers/runtime/${runtimeVersion}/versions.yaml"
|
||||||
|
|
||||||
|
GO_VERSION=$(curl -sSL "${runtimeVersionsURL}" | $yq r - languages.golang.version)
|
||||||
|
info "Detected Go version: $GO_VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
while getopts a:hlo:r:t: opt
|
while getopts a:hlo:r:t: opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
@ -311,6 +321,8 @@ fi
|
|||||||
|
|
||||||
mkdir -p ${ROOTFS_DIR}
|
mkdir -p ${ROOTFS_DIR}
|
||||||
|
|
||||||
|
detect_go_version
|
||||||
|
|
||||||
if [ -n "${USE_DOCKER}" ] ; then
|
if [ -n "${USE_DOCKER}" ] ; then
|
||||||
image_name="${distro}-rootfs-osbuilder"
|
image_name="${distro}-rootfs-osbuilder"
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
GO_VERSION=1.11.1
|
|
Loading…
Reference in New Issue
Block a user