mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-13 03:14:31 +01:00
Let's add support for caching Kernel artefacts that are generated using the kata-deploy local-build scripts. Right now those are not used, but we'll switch to using them very soon as part of upcoming changes of how we build the components we test in our CI. Fixes: #6480 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com> Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2021 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
source "${script_dir}/../../scripts/lib.sh"
|
|
|
|
readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh"
|
|
|
|
DESTDIR=${DESTDIR:-${PWD}}
|
|
PREFIX=${PREFIX:-/opt/kata}
|
|
container_image="${KERNEL_CONTAINER_BUILDER:-$(get_kernel_image_name)}"
|
|
|
|
sudo docker pull ${container_image} || \
|
|
(sudo docker build -t "${container_image}" "${script_dir}" && \
|
|
# No-op unless PUSH_TO_REGISTRY is exported as "yes"
|
|
push_to_registry "${container_image}")
|
|
|
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
|
-w "${PWD}" \
|
|
"${container_image}" \
|
|
bash -c "${kernel_builder} $* setup"
|
|
|
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
|
-w "${PWD}" \
|
|
"${container_image}" \
|
|
bash -c "${kernel_builder} $* build"
|
|
|
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
|
-w "${PWD}" \
|
|
--env DESTDIR="${DESTDIR}" --env PREFIX="${PREFIX}" \
|
|
"${container_image}" \
|
|
bash -c "${kernel_builder} $* install"
|