mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 19:35:32 +00:00
packaging: agent: Allow building in all arches
We're moving away from alpine and using ubuntu in order to be able to build the agent for all the architectures we need. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
1039641ab8
commit
5b0d0687e5
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,3 +15,4 @@ src/agent/protocols/src/*.rs
|
|||||||
!src/agent/protocols/src/lib.rs
|
!src/agent/protocols/src/lib.rs
|
||||||
build
|
build
|
||||||
src/tools/log-parser/kata-log-parser
|
src/tools/log-parser/kata-log-parser
|
||||||
|
tools/packaging/static-build/agent/install_libseccomp.sh
|
||||||
|
@ -64,6 +64,9 @@ kata-tarball: | all-parallel merge-builds
|
|||||||
$(MK_DIR)/dockerbuild/install_yq.sh:
|
$(MK_DIR)/dockerbuild/install_yq.sh:
|
||||||
$(MK_DIR)/kata-deploy-copy-yq-installer.sh
|
$(MK_DIR)/kata-deploy-copy-yq-installer.sh
|
||||||
|
|
||||||
|
copy-scripts-for-the-agent-build:
|
||||||
|
${MK_DIR}/kata-deploy-copy-libseccomp-installer.sh
|
||||||
|
|
||||||
all-parallel: $(MK_DIR)/dockerbuild/install_yq.sh
|
all-parallel: $(MK_DIR)/dockerbuild/install_yq.sh
|
||||||
${MAKE} -f $(MK_PATH) all -j $(shell nproc ${CI:+--ignore 1}) V=
|
${MAKE} -f $(MK_PATH) all -j $(shell nproc ${CI:+--ignore 1}) V=
|
||||||
|
|
||||||
@ -76,10 +79,10 @@ serial-targets:
|
|||||||
%-tarball-build: $(MK_DIR)/dockerbuild/install_yq.sh
|
%-tarball-build: $(MK_DIR)/dockerbuild/install_yq.sh
|
||||||
$(call BUILD,$*)
|
$(call BUILD,$*)
|
||||||
|
|
||||||
agent-tarball:
|
agent-tarball: copy-scripts-for-the-agent-build
|
||||||
${MAKE} $@-build
|
${MAKE} $@-build
|
||||||
|
|
||||||
agent-opa-tarball:
|
agent-opa-tarball: copy-scripts-for-the-agent-build
|
||||||
${MAKE} $@-build
|
${MAKE} $@-build
|
||||||
|
|
||||||
agent-ctl-tarball:
|
agent-ctl-tarball:
|
||||||
|
@ -681,6 +681,11 @@ install_agent_helper() {
|
|||||||
"${final_tarball_path}" \
|
"${final_tarball_path}" \
|
||||||
&& return 0
|
&& return 0
|
||||||
|
|
||||||
|
export LIBSECCOMP_VERSION="$(get_from_kata_deps "externals.libseccomp.version")"
|
||||||
|
export LIBSECCOMP_URL="$(get_from_kata_deps "externals.libseccomp.url")"
|
||||||
|
export GPERF_VERSION="$(get_from_kata_deps "externals.gperf.version")"
|
||||||
|
export GPERF_URL="$(get_from_kata_deps "externals.gperf.url")"
|
||||||
|
|
||||||
info "build static agent"
|
info "build static agent"
|
||||||
DESTDIR="${destdir}" AGENT_POLICY=${agent_policy} "${agent_builder}"
|
DESTDIR="${destdir}" AGENT_POLICY=${agent_policy} "${agent_builder}"
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
[ -z "${DEBUG}" ] || set -x
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
set -o errtrace
|
||||||
|
|
||||||
|
script_dir=$(dirname "$(readlink -f "$0")")
|
||||||
|
install_libseccomp_script_src="${script_dir}/../../../../ci/install_libseccomp.sh"
|
||||||
|
install_libseccomp_script_dest="${script_dir}/../../static-build/agent/install_libseccomp.sh"
|
||||||
|
|
||||||
|
cp "${install_libseccomp_script_src}" "${install_libseccomp_script_dest}"
|
||||||
|
|
||||||
|
# We don't have to import any other file, as we're passing
|
||||||
|
# the env vars needed for installing libseccomp and gperf.
|
||||||
|
sed -i -e '/^source.*$/d' ${install_libseccomp_script_dest}
|
@ -2,20 +2,25 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
FROM alpine:3.18
|
FROM ubuntu:22.04
|
||||||
ARG RUST_TOOLCHAIN
|
ARG RUST_TOOLCHAIN
|
||||||
|
|
||||||
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
|
COPY install_libseccomp.sh /usr/bin/install_libseccomp.sh
|
||||||
RUN apk --no-cache add \
|
|
||||||
bash \
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
curl \
|
|
||||||
gcc \
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
git \
|
RUN apt-get update && \
|
||||||
libcap-ng-static \
|
apt-get --no-install-recommends -y install \
|
||||||
libseccomp-static \
|
ca-certificates \
|
||||||
make \
|
curl \
|
||||||
musl-dev \
|
g++ \
|
||||||
openssl-dev \
|
gcc \
|
||||||
openssl-libs-static \
|
libssl-dev \
|
||||||
protoc && \
|
make \
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN}
|
musl-tools \
|
||||||
|
openssl \
|
||||||
|
perl \
|
||||||
|
protobuf-compiler && \
|
||||||
|
apt-get clean && rm -rf /var/lib/apt/lists/ && \
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN}
|
||||||
|
@ -15,13 +15,30 @@ source "${script_dir}/../../scripts/lib.sh"
|
|||||||
init_env() {
|
init_env() {
|
||||||
source "$HOME/.cargo/env"
|
source "$HOME/.cargo/env"
|
||||||
|
|
||||||
export LIBC=musl
|
ARCH=$(uname -m)
|
||||||
|
rust_arch=""
|
||||||
|
case ${ARCH} in
|
||||||
|
"aarch64")
|
||||||
|
export LIBC=musl
|
||||||
|
rust_arch=${ARCH}
|
||||||
|
;;
|
||||||
|
"ppc64le")
|
||||||
|
export LIBC=gnu
|
||||||
|
rust_arch="powerpc64le"
|
||||||
|
;;
|
||||||
|
"x86_64")
|
||||||
|
export LIBC=musl
|
||||||
|
rust_arch=${ARCH}
|
||||||
|
;;
|
||||||
|
"s390x")
|
||||||
|
export LIBC=gnu
|
||||||
|
rust_arch=${ARCH}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
rustup target add ${rust_arch}-unknown-linux-${LIBC}
|
||||||
|
|
||||||
export LIBSECCOMP_LINK_TYPE=static
|
export LIBSECCOMP_LINK_TYPE=static
|
||||||
export LIBSECCOMP_LIB_PATH=/usr/lib
|
export LIBSECCOMP_LIB_PATH=/usr/lib
|
||||||
|
|
||||||
# This is needed to workaround
|
|
||||||
# https://github.com/sfackler/rust-openssl/issues/1624
|
|
||||||
export OPENSSL_NO_VENDOR=Y
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_agent_from_source() {
|
build_agent_from_source() {
|
||||||
@ -29,6 +46,8 @@ build_agent_from_source() {
|
|||||||
|
|
||||||
init_env
|
init_env
|
||||||
|
|
||||||
|
/usr/bin/install_libseccomp.sh /usr /usr
|
||||||
|
|
||||||
cd src/agent
|
cd src/agent
|
||||||
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make
|
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make
|
||||||
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make install
|
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make install
|
||||||
|
@ -26,6 +26,10 @@ sudo docker pull ${container_image} || \
|
|||||||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
||||||
--env DESTDIR=${DESTDIR} \
|
--env DESTDIR=${DESTDIR} \
|
||||||
--env AGENT_POLICY=${AGENT_POLICY:-no} \
|
--env AGENT_POLICY=${AGENT_POLICY:-no} \
|
||||||
|
--env LIBSECCOMP_VERSION=${LIBSECCOMP_VERSION} \
|
||||||
|
--env LIBSECCOMP_URL=${LIBSECCOMP_URL} \
|
||||||
|
--env GPERF_VERSION=${GPERF_VERSION} \
|
||||||
|
--env GPERF_URL=${GPERF_URL} \
|
||||||
-w "${repo_root_dir}" \
|
-w "${repo_root_dir}" \
|
||||||
"${container_image}" \
|
"${container_image}" \
|
||||||
bash -c "${agent_builder}"
|
bash -c "${agent_builder}"
|
||||||
|
Loading…
Reference in New Issue
Block a user