mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
Merge pull request #813 from jcvenegas/ch-tarball-build
kata-static: Add cloud-hypervisor to tarball
This commit is contained in:
commit
5c636a2199
@ -10,6 +10,7 @@ set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
supported_artifacts=(
|
||||
"install_clh"
|
||||
"install_docker_config_script"
|
||||
"install_experimental_kernel"
|
||||
"install_firecracker"
|
||||
|
@ -167,6 +167,19 @@ install_firecracker() {
|
||||
popd
|
||||
}
|
||||
|
||||
# Install static cloud-hypervisor asset
|
||||
install_clh() {
|
||||
info "build static cloud-hypervisor"
|
||||
"${script_dir}/../static-build/cloud-hypervisor/build-static-clh.sh"
|
||||
info "Install static cloud-hypervisor"
|
||||
mkdir -p "${destdir}/opt/kata/bin/"
|
||||
sudo install -D --owner root --group root --mode 0744 cloud-hypervisor/cloud-hypervisor "${destdir}/opt/kata/bin/cloud-hypervisor"
|
||||
pushd "${destdir}"
|
||||
# create tarball for github release action
|
||||
tar -czvf ../kata-static-clh.tar.gz *
|
||||
popd
|
||||
}
|
||||
|
||||
install_docker_config_script() {
|
||||
local docker_config_script_name="kata-configure-docker.sh"
|
||||
local docker_config_script="${script_dir}/../static-build/scripts/${docker_config_script_name}"
|
||||
@ -268,6 +281,7 @@ main() {
|
||||
install_kata_components
|
||||
install_experimental_kernel
|
||||
install_kernel
|
||||
install_clh
|
||||
install_qemu
|
||||
install_qemu_virtiofsd
|
||||
install_firecracker
|
||||
|
40
static-build/cloud-hypervisor/build-static-clh.sh
Executable file
40
static-build/cloud-hypervisor/build-static-clh.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
script_dir=$(dirname $(readlink -f "$0"))
|
||||
|
||||
source "${script_dir}/../../scripts/lib.sh"
|
||||
|
||||
cloud_hypervisor_repo="${cloud_hypervisor_repo:-}"
|
||||
cloud_hypervisor_version="${cloud_hypervisor_version:-}"
|
||||
|
||||
if [ -z "$cloud_hypervisor_repo" ]; then
|
||||
info "Get cloud_hypervisor information from runtime versions.yaml"
|
||||
cloud_hypervisor_url=$(get_from_kata_deps "assets.hypervisor.cloud_hypervisor.url")
|
||||
[ -n "$cloud_hypervisor_url" ] || die "failed to get cloud_hypervisor url"
|
||||
cloud_hypervisor_repo="${cloud_hypervisor_url}.git"
|
||||
fi
|
||||
[ -n "$cloud_hypervisor_repo" ] || die "failed to get cloud_hypervisor repo"
|
||||
|
||||
[ -n "$cloud_hypervisor_version" ] || cloud_hypervisor_version=$(get_from_kata_deps "assets.hypervisor.cloud_hypervisor.version")
|
||||
[ -n "$cloud_hypervisor_version" ] || die "failed to get cloud_hypervisor version"
|
||||
|
||||
info "Build ${cloud_hypervisor_repo} version: ${cloud_hypervisor_version}"
|
||||
|
||||
repo_dir=$(basename "${cloud_hypervisor_repo}")
|
||||
repo_dir="${repo_dir//.git}"
|
||||
|
||||
[ -d "${repo_dir}" ] || git clone "${cloud_hypervisor_repo}"
|
||||
cd "${repo_dir}"
|
||||
git fetch || true
|
||||
git checkout "${cloud_hypervisor_version}"
|
||||
"${script_dir}/docker-build/build.sh"
|
||||
rm -f cloud-hypervisor
|
||||
cp ./target/release/cloud-hypervisor .
|
12
static-build/cloud-hypervisor/docker-build/Dockerfile
Normal file
12
static-build/cloud-hypervisor/docker-build/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -yq build-essential mtools libssl-dev pkg-config curl git
|
||||
RUN nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
30
static-build/cloud-hypervisor/docker-build/build.sh
Executable file
30
static-build/cloud-hypervisor/docker-build/build.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
script_dir=$(dirname $(readlink -f "$0"))
|
||||
docker_image="cloud-hypervisor-builder"
|
||||
|
||||
docker build -t "${docker_image}" "${script_dir}"
|
||||
|
||||
if test -t 1; then
|
||||
USE_TTY="-ti"
|
||||
else
|
||||
USE_TTY=""
|
||||
echo "INFO: not tty build"
|
||||
fi
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
-v "$(pwd):/$(pwd)" \
|
||||
-w "$(pwd)" \
|
||||
--env "CARGO_HOME=$(pwd)" \
|
||||
${USE_TTY} \
|
||||
"${docker_image}" \
|
||||
cargo build --release
|
@ -41,6 +41,7 @@ RUN apt-get install -y \
|
||||
RUN cd .. && git clone "${QEMU_VIRTIOFS_REPO}" qemu-virtiofs
|
||||
RUN git checkout "${QEMU_VIRTIOFS_TAG}"
|
||||
ADD qemu/patches/virtiofsd/0001-add-time-to-seccomp.patch /root/0001-add-time-to-seccomp.patch
|
||||
ADD qemu/patches/virtiofsd/0002-libvhost-user-Fix-the-VHOST_USER_PROTOCOL_F_SLAVE_SE.patch /root/0002-libvhost-user-Fix-the-VHOST_USER_PROTOCOL_F_SLAVE_SE.patch
|
||||
RUN patch -p1 < /root/0001-add-time-to-seccomp.patch
|
||||
RUN patch -p1 < /root/0002-libvhost-user-Fix-the-VHOST_USER_PROTOCOL_F_SLAVE_SE.patch
|
||||
ADD scripts/configure-hypervisor.sh /root/configure-hypervisor.sh
|
||||
|
Loading…
Reference in New Issue
Block a user