mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 09:51:29 +00:00
packaging: Don't build the agent if not needed
Let's start relying on the already cached agent to be deployed inside the rootfs. By doing this we save a lot of time in our CI, and we have a better way, for developers, to play with changes in the agent. Fixes: #8915 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
21fd7e6dfd
commit
dd49479829
@ -20,6 +20,7 @@ source "${packaging_root_dir}/scripts/lib.sh"
|
||||
readonly osbuilder_dir="$(cd "${repo_root_dir}/tools/osbuilder" && pwd)"
|
||||
|
||||
export GOPATH=${GOPATH:-${HOME}/go}
|
||||
export AGENT_TARBALL=${AGENT_TARBALL:-}
|
||||
|
||||
ARCH=${ARCH:-$(uname -m)}
|
||||
if [ $(uname -m) == "${ARCH}" ]; then
|
||||
@ -41,6 +42,7 @@ build_initrd() {
|
||||
OS_VERSION="${os_version}" \
|
||||
ROOTFS_BUILD_DEST="${builddir}/initrd-image" \
|
||||
USE_DOCKER=1 \
|
||||
AGENT_TARBALL="${AGENT_TARBALL}" \
|
||||
AGENT_INIT="yes" \
|
||||
AGENT_POLICY="${AGENT_POLICY:-}"
|
||||
mv "kata-containers-initrd.img" "${install_dir}/${artifact_name}"
|
||||
@ -60,6 +62,7 @@ build_image() {
|
||||
USE_DOCKER="1" \
|
||||
IMG_OS_VERSION="${os_version}" \
|
||||
ROOTFS_BUILD_DEST="${builddir}/rootfs-image" \
|
||||
AGENT_TARBALL="${AGENT_TARBALL}" \
|
||||
AGENT_POLICY="${AGENT_POLICY:-}"
|
||||
mv -f "kata-containers.img" "${install_dir}/${artifact_name}"
|
||||
if [ -e "root_hash.txt" ]; then
|
||||
|
@ -154,19 +154,19 @@ qemu-tdx-experimental-tarball:
|
||||
stratovirt-tarball:
|
||||
${MAKE} $@-build
|
||||
|
||||
rootfs-image-tarball:
|
||||
rootfs-image-tarball: agent-tarball
|
||||
${MAKE} $@-build
|
||||
|
||||
rootfs-image-tdx-tarball: kernel-tdx-experimental-tarball
|
||||
rootfs-image-tdx-tarball: agent-opa-tarball kernel-tdx-experimental-tarball
|
||||
${MAKE} $@-build
|
||||
|
||||
rootfs-initrd-mariner-tarball:
|
||||
rootfs-initrd-mariner-tarball: agent-opa-tarball
|
||||
${MAKE} $@-build
|
||||
|
||||
rootfs-initrd-sev-tarball: kernel-sev-tarball
|
||||
rootfs-initrd-sev-tarball: agent-opa-tarball kernel-sev-tarball
|
||||
${MAKE} $@-build
|
||||
|
||||
rootfs-initrd-tarball:
|
||||
rootfs-initrd-tarball: agent-tarball
|
||||
${MAKE} $@-build
|
||||
|
||||
runk-tarball:
|
||||
|
@ -156,6 +156,16 @@ install_cached_tarball_component() {
|
||||
mv "${component_tarball_name}" "${component_tarball_path}"
|
||||
}
|
||||
|
||||
get_agent_tarball_path() {
|
||||
agent_local_build_dir="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build"
|
||||
agent_tarball_name="kata-static-agent.tar.xz"
|
||||
if [ "${AGENT_POLICY:-no}" = "yes" ]; then
|
||||
agent_tarball_name="kata-static-agent-opa.tar.xz"
|
||||
fi
|
||||
|
||||
echo "${agent_local_build_dir}/${agent_tarball_name}"
|
||||
}
|
||||
|
||||
#Install guest image
|
||||
install_image() {
|
||||
local variant="${1:-}"
|
||||
@ -196,6 +206,7 @@ install_image() {
|
||||
os_version="$(get_from_kata_deps "assets.image.architecture.${ARCH}.version")"
|
||||
fi
|
||||
|
||||
export AGENT_TARBALL=$(get_agent_tarball_path)
|
||||
"${rootfs_builder}" --osname="${os_name}" --osversion="${os_version}" --imagetype=image --prefix="${prefix}" --destdir="${destdir}" --image_initrd_suffix="${variant}"
|
||||
}
|
||||
|
||||
@ -247,6 +258,7 @@ install_initrd() {
|
||||
os_version="$(get_from_kata_deps "assets.initrd.architecture.${ARCH}.version")"
|
||||
fi
|
||||
|
||||
export AGENT_TARBALL=$(get_agent_tarball_path)
|
||||
"${rootfs_builder}" --osname="${os_name}" --osversion="${os_version}" --imagetype=initrd --prefix="${prefix}" --destdir="${destdir}" --image_initrd_suffix="${variant}"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user