mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-01 07:47:15 +00:00
Merge pull request #126 from jcvenegas/static-builds
Kata 1.2.0 packaging
This commit is contained in:
commit
fa711da0eb
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,16 +1,19 @@
|
||||
typescript
|
||||
debian.series
|
||||
*.img
|
||||
*.initrd
|
||||
*.tar.gz
|
||||
*.sha256
|
||||
*.snap
|
||||
*.tar.gz
|
||||
*.tar.xz
|
||||
debian.series
|
||||
parts/
|
||||
prime/
|
||||
stage/
|
||||
snap/.snapcraft/
|
||||
snap/snapcraft.yaml
|
||||
snap-build/*.log
|
||||
snap-build/*.img
|
||||
sha256sums.asc
|
||||
snap-build/*.fd
|
||||
snap-build/*.img
|
||||
snap-build/*.log
|
||||
snap-build/id_rsa*
|
||||
snap-build/seed/user-data
|
||||
snap/.snapcraft/
|
||||
snap/snapcraft.yaml
|
||||
stage/
|
||||
typescript
|
||||
|
@ -149,7 +149,7 @@ get_config_version() {
|
||||
if [ -f "${config_version_file}" ]; then
|
||||
cat "${config_version_file}"
|
||||
else
|
||||
echo "unknown"
|
||||
die "failed to find ${config_version_file}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
7
|
||||
8
|
||||
|
@ -4,24 +4,31 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
script_dir=$(dirname "$0")
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
#Note:Lets update qemu and the kernel first, they take longer to build.
|
||||
#Note: runtime is build at the end to get the version from all its dependencies.
|
||||
projects=(
|
||||
qemu-lite
|
||||
qemu-vanilla
|
||||
kernel
|
||||
kata-containers-image
|
||||
proxy
|
||||
shim
|
||||
ksm-throttler
|
||||
runtime
|
||||
qemu-lite
|
||||
qemu-vanilla
|
||||
kernel
|
||||
kata-containers-image
|
||||
proxy
|
||||
shim
|
||||
ksm-throttler
|
||||
runtime
|
||||
)
|
||||
|
||||
OSCRC="${HOME}/.oscrc"
|
||||
PUSH=${PUSH:-""}
|
||||
LOCAL=${LOCAL:-""}
|
||||
PUSH_TO_OBS=""
|
||||
|
||||
export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
|
||||
# Packaging use this variable instead of use git user value
|
||||
@ -29,32 +36,50 @@ export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
|
||||
export AUTHOR="${AUTHOR:-user}"
|
||||
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
|
||||
|
||||
cd "$script_dir"
|
||||
|
||||
OBS_API="https://api.opensuse.org"
|
||||
|
||||
if [ -n "${OBS_USER}" ] && [ -n "${OBS_PASS}" ] && [ ! -e "${OSCRC}" ]; then
|
||||
echo "Creating ${OSCRC} with user $OBS_USER"
|
||||
cat << eom > "${OSCRC}"
|
||||
usage() {
|
||||
msg="${1:-}"
|
||||
exit_code=$"${2:-0}"
|
||||
cat <<EOT
|
||||
${msg}
|
||||
Usage:
|
||||
${script_name} <kata-branch>
|
||||
EOT
|
||||
exit "${exit_code}"
|
||||
}
|
||||
|
||||
main() {
|
||||
local branch="${1:-}"
|
||||
[ -n "${branch}" ] || usage "missing branch" "1"
|
||||
if [ -n "${OBS_USER:-}" ] && [ -n "${OBS_PASS:-}" ] && [ ! -e "${OSCRC:-}" ]; then
|
||||
echo "Creating ${OSCRC} with user $OBS_USER"
|
||||
cat <<eom >"${OSCRC}"
|
||||
[general]
|
||||
apiurl = ${OBS_API}
|
||||
[${OBS_API}]
|
||||
user = ${OBS_USER}
|
||||
pass = ${OBS_PASS}
|
||||
eom
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${PUSH}" ]; then
|
||||
# push to obs
|
||||
PUSH_TO_OBS="-p"
|
||||
elif [ -n "${LOCAL}" ]; then
|
||||
# local build
|
||||
PUSH_TO_OBS="-l"
|
||||
fi
|
||||
pushd "${script_dir}"
|
||||
for p in "${projects[@]}"; do
|
||||
pushd "$p" >>/dev/null
|
||||
update_cmd="./update.sh"
|
||||
if [ -n "${PUSH}" ]; then
|
||||
# push to obs
|
||||
update_cmd+=" -p"
|
||||
elif [ -n "${LOCAL}" ]; then
|
||||
# local build
|
||||
update_cmd+=" -l"
|
||||
fi
|
||||
|
||||
for p in "${projects[@]}"; do
|
||||
pushd "$p" >> /dev/null
|
||||
echo "update ${p}"
|
||||
bash ./update.sh "${PUSH_TO_OBS}" -v
|
||||
popd >> /dev/null
|
||||
done
|
||||
echo "update ${p}"
|
||||
bash -c "${update_cmd} ${branch}"
|
||||
popd >>/dev/null
|
||||
done
|
||||
popd
|
||||
}
|
||||
|
||||
main $@
|
||||
|
@ -4,11 +4,14 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -x
|
||||
set -e
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
script_dir=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd )
|
||||
script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
cache_dir=${PWD}/obs-cache
|
||||
#where packaing repo lives
|
||||
packaging_repo_dir=$(cd "${script_dir}/.." && pwd )
|
||||
@ -16,38 +19,64 @@ packaging_repo_dir=$(cd "${script_dir}/.." && pwd )
|
||||
host_datadir="${PWD}/pkgs"
|
||||
obs_image="obs-kata"
|
||||
export USE_DOCKER=1
|
||||
http_proxy=${http_proxy:-}
|
||||
https_proxy=${https_proxy:-}
|
||||
no_proxy=${no_proxy:-}
|
||||
PUSH=${PUSH:-}
|
||||
|
||||
if command -v go; then
|
||||
export GO_ARCH=$(go env GOARCH)
|
||||
else
|
||||
export GO_ARCH=amd64
|
||||
echo "Go not installed using $GO_ARCH to install go in dockerfile"
|
||||
fi
|
||||
GO_ARCH=$(go env GOARCH)
|
||||
export GO_ARCH
|
||||
|
||||
export GO_ARCH=$(go env GOARCH)
|
||||
sudo docker build \
|
||||
--build-arg http_proxy="${http_proxy}" \
|
||||
--build-arg https_proxy="${https_proxy}" \
|
||||
-t $obs_image ${script_dir}
|
||||
docker_run(){
|
||||
local cmd="$@"
|
||||
sudo docker run \
|
||||
--rm \
|
||||
-v "${HOME}/.ssh":/root/.ssh \
|
||||
-v "${HOME}/.gitconfig":/root/.gitconfig \
|
||||
-v /etc/profile:/etc/profile \
|
||||
--env http_proxy="${http_proxy}" \
|
||||
--env https_proxy="${https_proxy}" \
|
||||
--env no_proxy="${no_proxy}" \
|
||||
--env PUSH="${PUSH}" \
|
||||
--env DEBUG="${DEBUG:-}" \
|
||||
--env OBS_SUBPROJECT="${OBS_SUBPROJECT:-}"\
|
||||
-v "${HOME}/.bashrc":/root/.bashrc \
|
||||
-v "$cache_dir":/var/tmp/osbuild-packagecache/ \
|
||||
-v "$packaging_repo_dir":${packaging_repo_dir} \
|
||||
-v "$host_datadir":/var/packaging \
|
||||
-v "$HOME/.oscrc":/root/.oscrc \
|
||||
-ti "$obs_image" bash -c "${cmd}"
|
||||
}
|
||||
usage(){
|
||||
msg="${1:-}"
|
||||
exit_code=$"${2:-0}"
|
||||
cat << EOT
|
||||
${msg}
|
||||
Usage:
|
||||
${script_name} <kata-branch>
|
||||
EOT
|
||||
exit "${exit_code}"
|
||||
}
|
||||
|
||||
pushd "${script_dir}/kata-containers-image/" >> /dev/null
|
||||
./build_image.sh
|
||||
popd >> /dev/null
|
||||
main(){
|
||||
local branch="${1:-}"
|
||||
[ -n "${branch}" ] || usage "missing branch" "1"
|
||||
pushd "${script_dir}/kata-containers-image/" >> /dev/null
|
||||
echo "Building image"
|
||||
image_tarball=$(find . -name 'kata-containers-'"${branch}"'-*.tar.gz')
|
||||
[ -f "${image_tarball}" ] || "${script_dir}/../obs-packaging/kata-containers-image/build_image.sh" -v "${branch}"
|
||||
image_tarball=$(find . -name 'kata-containers-'"${branch}"'-*.tar.gz')
|
||||
[ -f "${image_tarball}" ] || die "image not found"
|
||||
popd >> /dev/null
|
||||
sudo docker build \
|
||||
--build-arg http_proxy="${http_proxy}" \
|
||||
--build-arg https_proxy="${https_proxy}" \
|
||||
-t $obs_image "${script_dir}"
|
||||
|
||||
function faketty { script -qfc "$(printf "%q " "$@")"; }
|
||||
#Create/update OBS repository for branch
|
||||
#docker_run "${packaging_repo_dir}/obs-packaging/create-pkg-branch.sh ${branch}"
|
||||
#Build all kata packages
|
||||
docker_run "${packaging_repo_dir}/obs-packaging/build_all.sh ${branch}"
|
||||
}
|
||||
|
||||
faketty sudo docker run \
|
||||
--rm \
|
||||
-v "${HOME}/.ssh":/root/.ssh \
|
||||
-v "${HOME}/.gitconfig":/root/.gitconfig \
|
||||
-v /etc/profile:/etc/profile \
|
||||
--env http_proxy="${http_proxy}" \
|
||||
--env https_proxy="${https_proxy}" \
|
||||
--env no_proxy="${no_proxy}" \
|
||||
--env PUSH="${PUSH}" \
|
||||
-v "${HOME}/.bashrc":/root/.bashrc \
|
||||
-v "$cache_dir":/var/tmp/osbuild-packagecache/ \
|
||||
-v "$packaging_repo_dir":${packaging_repo_dir} \
|
||||
-v "$host_datadir":/var/packaging \
|
||||
-v "$HOME/.oscrc":/root/.oscrc \
|
||||
-ti "$obs_image" bash -c "${packaging_repo_dir}/obs-packaging/build_all.sh"
|
||||
main $@
|
||||
|
104
obs-packaging/gen_versions_txt.sh
Executable file
104
obs-packaging/gen_versions_txt.sh
Executable file
@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[ -z "${DEBUG}" ] || set -x
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
project="kata-containers"
|
||||
|
||||
source "${script_dir}/../scripts/lib.sh"
|
||||
|
||||
get_kata_hash_from_tag(){
|
||||
repo=$1
|
||||
git ls-remote --tags "https://github.com/${project}/${repo}.git" | grep "refs/tags/${kata_version}^{}" | awk '{print $1}'
|
||||
}
|
||||
|
||||
gen_version_file(){
|
||||
local branch="$1"
|
||||
[ -n "${branch}" ] || exit 1
|
||||
|
||||
local kata_version=$(curl --silent -L "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION")
|
||||
kata_runtime_hash=$(get_kata_hash_from_tag "runtime" "${kata_version}")
|
||||
kata_proxy_hash=$(get_kata_hash_from_tag "proxy" "${kata_version}")
|
||||
kata_shim_hash=$(get_kata_hash_from_tag "shim" "${kata_version}")
|
||||
kata_agent_hash=$(get_kata_hash_from_tag "agent" "${kata_version}")
|
||||
kata_ksm_throttler_hash=$(get_kata_hash_from_tag "ksm-throttler" "${kata_version}")
|
||||
|
||||
|
||||
qemu_lite_branch=$(get_from_kata_deps "assets.hypervisor.qemu-lite.branch" "${kata_version}")
|
||||
qemu_lite_version=$(curl -s -L "https://raw.githubusercontent.com/${project}/qemu/${qemu_lite_branch}/VERSION")
|
||||
qemu_lite_hash=$(git ls-remote https://github.com/${project}/qemu.git | grep "refs/heads/${qemu_lite_branch}" | awk '{print $1}')
|
||||
|
||||
qemu_vanilla_branch=$(get_from_kata_deps "assets.hypervisor.qemu.version" "${kata_version}")
|
||||
qemu_vanilla_version=$(curl -s -L "https://raw.githubusercontent.com/qemu/qemu/${qemu_vanilla_branch}/VERSION")
|
||||
qemu_vanilla_hash=$(git ls-remote https://github.com/qemu/qemu.git | grep "refs/heads/${qemu_vanilla_branch}" | awk '{print $1}')
|
||||
|
||||
kernel_version=$(get_from_kata_deps "assets.kernel.version" "${kata_version}")
|
||||
#Remove extra 'v'
|
||||
kernel_version=${kernel_version#v}
|
||||
|
||||
golang_version=$(get_from_kata_deps "languages.golang.meta.newest-version" "${kata_version}")
|
||||
golang_version="1.10.2"
|
||||
golang_x84_64_sha256=$(curl -s -L "https://storage.googleapis.com/golang/go${golang_version}.linux-amd64.tar.gz.sha256")
|
||||
|
||||
cat > versions.txt << EOT
|
||||
|
||||
# This is a generated file from ${script_name}
|
||||
|
||||
kata_runtime_version=${kata_version}
|
||||
kata_runtime_hash=${kata_runtime_hash}
|
||||
|
||||
kata_proxy_version=${kata_version}
|
||||
kata_proxy_hash=${kata_proxy_hash}
|
||||
|
||||
kata_shim_version=${kata_version}
|
||||
kata_shim_hash=${kata_shim_hash}
|
||||
|
||||
kata_agent_version=${kata_version}
|
||||
kata_agent_hash=${kata_agent_hash}
|
||||
|
||||
kata_ksm_throttler_version=${kata_version}
|
||||
kata_ksm_throttler_hash=${kata_ksm_throttler_hash}
|
||||
|
||||
# Dependencies
|
||||
kata_osbuilder_version=${kata_version}
|
||||
|
||||
qemu_lite_version=${qemu_lite_version}
|
||||
qemu_lite_hash=${qemu_lite_hash}
|
||||
|
||||
qemu_vanilla_version=${qemu_vanilla_version}
|
||||
qemu_vanilla_hash=${qemu_lite_hash}
|
||||
|
||||
kernel_version=${kernel_version}
|
||||
|
||||
# Golang
|
||||
go_version=${golang_version}
|
||||
go_checksum=${golang_x84_64_sha256}
|
||||
EOT
|
||||
}
|
||||
|
||||
usage(){
|
||||
msg="${1:-}"
|
||||
exit_code=$"${2:-0}"
|
||||
cat << EOT
|
||||
${msg}
|
||||
Usage:
|
||||
${script_name} <kata-branch>
|
||||
EOT
|
||||
exit "${exit_code}"
|
||||
}
|
||||
|
||||
main(){
|
||||
local branch="${1:-}"
|
||||
[ -n "${branch}" ] || usage "missing branch" "1"
|
||||
gen_version_file "${branch}"
|
||||
}
|
||||
|
||||
main $@
|
@ -11,8 +11,6 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
[ -z "${DEBUG:-}" ] || set -x
|
||||
|
||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly project="kata-containers"
|
||||
@ -25,13 +23,6 @@ source "${script_dir}/../../scripts/lib.sh"
|
||||
|
||||
|
||||
arch_target="$(uname -m)"
|
||||
#image information
|
||||
img_distro=$(get_from_kata_deps "assets.image.architecture.${arch_target}.name")
|
||||
img_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version")
|
||||
|
||||
#initrd information
|
||||
initrd_distro=$(get_from_kata_deps "assets.image.architecture.${arch_target}.name")
|
||||
initrd_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version")
|
||||
|
||||
kata_version="master"
|
||||
|
||||
@ -41,11 +32,12 @@ kata_osbuilder_version="${KATA_OSBUILDER_VERSION:-}"
|
||||
agent_version="${AGENT_VERSION:-}"
|
||||
|
||||
|
||||
readonly destdir="${script_dir}"
|
||||
readonly destdir="${PWD}"
|
||||
|
||||
build_initrd(){
|
||||
sudo -E PATH="$PATH" make initrd\
|
||||
DISTRO="$initrd_distro" \
|
||||
DEBUG="${DEBUG:-}" \
|
||||
AGENT_VERSION="${agent_version}" \
|
||||
OS_VERSION="${initrd_os_version}" \
|
||||
DISTRO_ROOTFS="${tmp_dir}/initrd-image" \
|
||||
@ -57,6 +49,7 @@ build_initrd(){
|
||||
build_image(){
|
||||
sudo -E PATH="${PATH}" make image \
|
||||
DISTRO="${img_distro}" \
|
||||
DEBUG="${DEBUG:-}" \
|
||||
AGENT_VERSION="${agent_version}" \
|
||||
IMG_OS_VERSION="${img_os_version}" \
|
||||
DISTRO_ROOTFS="${tmp_dir}/rootfs-image"
|
||||
@ -107,6 +100,14 @@ main(){
|
||||
# Agent version
|
||||
[ -n "${agent_version}" ] || agent_version="${kata_version}"
|
||||
|
||||
#image information
|
||||
img_distro=$(get_from_kata_deps "assets.image.architecture.${arch_target}.name" "${kata_version}")
|
||||
img_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version" "${kata_version}")
|
||||
|
||||
#initrd information
|
||||
initrd_distro=$(get_from_kata_deps "assets.image.architecture.${arch_target}.name" "${kata_version}")
|
||||
initrd_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version" "${kata_version}")
|
||||
|
||||
shift "$(( $OPTIND - 1 ))"
|
||||
git clone "$osbuilder_url" "${tmp_dir}/osbuilder"
|
||||
pushd "${tmp_dir}/osbuilder"
|
||||
|
@ -1,7 +1,5 @@
|
||||
%define version @VERSION@
|
||||
%define release @RELEASE@
|
||||
%define agent_sha @AGENT_SHA@
|
||||
%define rootfs_os @ROOTFS_OS@
|
||||
|
||||
Name: kata-containers-image
|
||||
Version: %{version}
|
||||
|
@ -11,7 +11,12 @@
|
||||
# Automation script to create specs to build kata-containers-image
|
||||
# Default image to build is the one specified in file versions.txt
|
||||
# located at the root of the repository.
|
||||
set -e
|
||||
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -31,7 +36,6 @@ cli "$@"
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/kata-containers-image}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
function check_image() {
|
||||
[ ! -f "${SCRIPT_DIR}/kata-containers.tar.gz" ] && die "No kata-containers.tar.gz found!\nUse the build_image.sh script" || echo "Image: OK"
|
||||
@ -40,14 +44,19 @@ function check_image() {
|
||||
replace_list=(
|
||||
"VERSION=$VERSION"
|
||||
"RELEASE=$RELEASE"
|
||||
"AGENT_SHA=${kata_agent_hash:0:7}"
|
||||
"ROOTFS_OS=$osbuilder_default_os"
|
||||
)
|
||||
|
||||
verify
|
||||
rm -rf kata-containers.tar.gz
|
||||
image_tarball=$(find . -name 'kata-containers-'"${VERSION}"'-*.tar.gz')
|
||||
[ -f "${image_tarball}" ] || die "image not found"
|
||||
cp "${image_tarball}" kata-containers.tar.gz
|
||||
|
||||
check_image
|
||||
echo "Verify succeed."
|
||||
get_git_info
|
||||
#TODO delete me: used by changelog_update
|
||||
hash_tag="nocommit"
|
||||
changelog_update $VERSION
|
||||
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
|
||||
build_pkg "${PROJECT_REPO}"
|
||||
|
@ -9,7 +9,11 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Automation script to create specs to build Kata containers kernel
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -56,6 +60,8 @@ replace_list=(
|
||||
verify
|
||||
echo "Verify succeed."
|
||||
get_git_info
|
||||
#TODO delete me: used by changelog_update
|
||||
hash_tag="nocommit"
|
||||
changelog_update "${VERSION}-${KATA_CONFIG_VERSION}"
|
||||
ln -sfT "${SCRIPT_DIR}/../../kernel/patches" "${SCRIPT_DIR}/patches"
|
||||
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
|
||||
|
@ -11,7 +11,11 @@
|
||||
# Automation script to create specs to build ksm-throttler.
|
||||
# Default: Build is the one specified in file configure.ac
|
||||
# located at the root of the repository.
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -32,7 +36,6 @@ cli "$@"
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
set_versions "$kata_ksm_throttler_hash"
|
||||
|
||||
|
@ -6,11 +6,7 @@
|
||||
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
|
||||
%global GO_VERSION @GO_VERSION@
|
||||
|
||||
%if 0%{?suse_version}
|
||||
%define LIBEXECDIR %{_libdir}
|
||||
%else
|
||||
%define LIBEXECDIR %{_libexecdir}
|
||||
%endif
|
||||
%define LIBEXECDIR /usr/libexec
|
||||
|
||||
%undefine _missing_build_ids_terminate_build
|
||||
Name: kata-proxy
|
||||
|
@ -8,7 +8,11 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Automation script to create specs to build kata-proxy
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -28,7 +32,6 @@ cli "$@"
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/proxy}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
set_versions $kata_proxy_hash
|
||||
|
||||
|
@ -8,7 +8,11 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Automation script to create specs to build kata containers kernel
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -28,8 +32,8 @@ cli "$@"
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-lite}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
set_versions "${qemu_lite_hash}"
|
||||
|
||||
replace_list=(
|
||||
"VERSION=$VERSION"
|
||||
|
@ -7,7 +7,7 @@
|
||||
<param name="filename">qemu-vanilla</param>
|
||||
<!--- %h in the version format is a hash from a given revision -->
|
||||
<param name="versionformat">@VERSION@+git.%h</param>
|
||||
<param name="revision">stable-@VERSION@</param>
|
||||
<param name="revision">@QEMU_VANILLA_HASH@</param>
|
||||
</service>
|
||||
<service name="recompress">
|
||||
<param name="file">*.tar*</param>
|
||||
|
@ -9,7 +9,11 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Automation script to create specs to build kata containers kernel
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -29,7 +33,8 @@ cli "$@"
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-vanilla}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
set_versions "${qemu_vanilla_hash}"
|
||||
|
||||
replace_list=(
|
||||
"VERSION=$VERSION"
|
||||
|
@ -11,7 +11,11 @@
|
||||
# Automation script to create specs to build kata-runtime
|
||||
# Default: Build is the one specified in file configure.ac
|
||||
# located at the root of the repository.
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -51,7 +55,7 @@ info "shim ${SHIM_REQUIRED_VERSION}"
|
||||
|
||||
KERNEL_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/linux-container")
|
||||
KERNEL_CONFIG_VERSION=$(cat "${SCRIPT_DIR}/../../kernel/kata_config_version")
|
||||
KERNEL_REQUIRED_VERSION=$(pkg_version "${kernel_version}.${KERNEL_CONFIG_VERSION}" "${KERNEL_RELEASE}")
|
||||
KERNEL_REQUIRED_VERSION=$(pkg_version "${kernel_version}.${KERNEL_CONFIG_VERSION}" "${KERNEL_RELEASE}" "")
|
||||
info "kata-linux-container ${KERNEL_REQUIRED_VERSION}"
|
||||
|
||||
KSM_THROTTLER_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler")
|
||||
@ -59,23 +63,21 @@ KSM_THROTTLER_REQUIRED_VERSION=$(pkg_version "${kata_ksm_throttler_version}" "${
|
||||
info "ksm-throttler ${KSM_THROTTLER_REQUIRED_VERSION}"
|
||||
|
||||
KATA_CONTAINERS_IMAGE_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/kata-containers-image")
|
||||
KATA_IMAGE_REQUIRED_VERSION=$(pkg_version "${kata_osbuilder_version}" "${KATA_CONTAINERS_IMAGE_RELEASE}")
|
||||
KATA_IMAGE_REQUIRED_VERSION=$(pkg_version "${kata_osbuilder_version}" "${KATA_CONTAINERS_IMAGE_RELEASE}" "")
|
||||
info "image ${KATA_IMAGE_REQUIRED_VERSION}"
|
||||
|
||||
KATA_CONTAINERS_QEMU_LITE_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-lite")
|
||||
KATA_QEMU_LITE_REQUIRED_VERSION=$(pkg_version "${qemu_lite_version}" "${KATA_CONTAINERS_QEMU_LITE_RELEASE}")
|
||||
KATA_QEMU_LITE_REQUIRED_VERSION=$(pkg_version "${qemu_lite_version}" "${KATA_CONTAINERS_QEMU_LITE_RELEASE}" "")
|
||||
info "image ${KATA_QEMU_LITE_REQUIRED_VERSION}"
|
||||
|
||||
KATA_CONTAINERS_QEMU_VANILLA_RELEASE=$(get_obs_pkg_release "home:${OBS_PROJECT}:${OBS_SUBPROJECT}/qemu-vanilla")
|
||||
KATA_QEMU_VANILLA_REQUIRED_VERSION=$(pkg_version "${qemu_vanilla_version}" "${KATA_CONTAINERS_QEMU_VANILLA_RELEASE}")
|
||||
KATA_QEMU_VANILLA_REQUIRED_VERSION=$(pkg_version "${qemu_vanilla_version}" "${KATA_CONTAINERS_QEMU_VANILLA_RELEASE}" "")
|
||||
info "image ${KATA_QEMU_VANILLA_REQUIRED_VERSION}"
|
||||
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/runtime}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
set_versions "$kata_runtime_hash"
|
||||
|
||||
replace_list=(
|
||||
|
@ -47,7 +47,6 @@ function display_help()
|
||||
Options:
|
||||
|
||||
-l --local-build Build the runtime locally
|
||||
-c --commit-id Build with a given commit ID
|
||||
-b --branch Build with a given branch name
|
||||
-p --push Push changes to OBS
|
||||
-a --api-url Especify an OBS API (e.g. custom private OBS)
|
||||
@ -61,9 +60,9 @@ function display_help()
|
||||
Usage examples:
|
||||
|
||||
$SCRIPT_NAME --local-build --branch staging
|
||||
$SCRIPT_NAME --commit-id a76f45c --push --api-url http://127.0.0.1
|
||||
$SCRIPT_NAME --commit-id a76f45c --push --obs-repository home:userx/repository
|
||||
$SCRIPT_NAME --commit-id a76f45c --push
|
||||
$SCRIPT_NAME --push --api-url http://127.0.0.1
|
||||
$SCRIPT_NAME --push --obs-repository home:userx/repository
|
||||
$SCRIPT_NAME --push
|
||||
|
||||
EOL
|
||||
exit 1
|
||||
@ -117,20 +116,7 @@ function get_git_info()
|
||||
function set_versions()
|
||||
{
|
||||
local commit_hash="$1"
|
||||
|
||||
if [ -n "$OBS_REVISION" ]
|
||||
then
|
||||
# Validate input is alphanumeric, commit ID
|
||||
# If a commit ID is provided, override versions.txt one
|
||||
if [ -n "$COMMIT" ] && [[ "$OBS_REVISION" =~ ^[a-zA-Z0-9][-a-zA-Z0-9]{0,40}[a-zA-Z0-9]$ ]]; then
|
||||
hash_tag=$OBS_REVISION
|
||||
elif [ -n "$BRANCH" ]
|
||||
then
|
||||
hash_tag=$commit_hash
|
||||
fi
|
||||
else
|
||||
hash_tag=$commit_hash
|
||||
fi
|
||||
hash_tag="$commit_hash"
|
||||
short_hashtag="${hash_tag:0:7}"
|
||||
}
|
||||
|
||||
@ -177,25 +163,23 @@ function local_build()
|
||||
|
||||
function checkout_repo()
|
||||
{
|
||||
local REPO="$1"
|
||||
if [ -z "$OBS_WORKDIR" ]
|
||||
local REPO="${1}"
|
||||
if [ -z "${OBS_WORKDIR:-}" ]
|
||||
then
|
||||
# If no workdir is provided, use a temporary directory.
|
||||
temp=$(basename $0)
|
||||
OBS_WORKDIR=$(mktemp -d -u -t ${temp}.XXXXXXXXXXX) || exit 1
|
||||
osc $APIURL co $REPO -o $OBS_WORKDIR
|
||||
OBS_WORKDIR=$(mktemp -d -u -t obs-repo.XXXXXXXXXXX) || exit 1
|
||||
osc co "${REPO}" -o "${OBS_WORKDIR}"
|
||||
fi
|
||||
find ${OBS_WORKDIR} -maxdepth 1 -mindepth 1 ! -name '.osc' -prune -exec echo remove {} \; -exec rm -rf {} \;
|
||||
find "${OBS_WORKDIR}" -maxdepth 1 -mindepth 1 ! -name '.osc' -prune -exec echo remove {} \; -exec rm -rf {} \;
|
||||
|
||||
mv ${GENERATED_FILES[@]} "$OBS_WORKDIR"
|
||||
cp ${STATIC_FILES[@]} "$OBS_WORKDIR"
|
||||
mv "${GENERATED_FILES[@]}" "${OBS_WORKDIR}"
|
||||
cp "${STATIC_FILES[@]}" "$OBS_WORKDIR"
|
||||
}
|
||||
|
||||
function obs_push()
|
||||
{
|
||||
pushd $OBS_WORKDIR
|
||||
osc $APIURL addremove
|
||||
osc $APIURL commit -m "Update ${PKG_NAME} $VERSION: ${hash_tag:0:7}"
|
||||
osc addremove
|
||||
osc commit -m "Update ${PKG_NAME} $VERSION: ${hash_tag:0:7}"
|
||||
popd
|
||||
}
|
||||
|
||||
@ -204,9 +188,7 @@ function cli()
|
||||
OPTS=$(getopt -o abclprwvCVh: --long api-url,branch,commit-id,local-build,push,obs-repository,workdir,verbose,clean,verify,help -- "$@")
|
||||
while true; do
|
||||
case "${1}" in
|
||||
-a | --api-url ) APIURL="$2"; shift 2;;
|
||||
-b | --branch ) BRANCH="true"; OBS_REVISION="$2"; shift 2;;
|
||||
-c | --commit-id ) COMMIT="true"; OBS_REVISION="$2"; shift 2;;
|
||||
-l | --local-build ) LOCAL_BUILD="true"; shift;;
|
||||
-p | --push ) OBS_PUSH="true"; shift;;
|
||||
-r | --obs-repository ) PROJECT_REPO="$2"; shift 2;;
|
||||
@ -313,15 +295,27 @@ function get_obs_pkg_release() {
|
||||
pkg=$(basename "${obs_pkg_name}")
|
||||
repo_dir=$(mktemp -d -u -t "${pkg}.XXXXXXXXXXX")
|
||||
|
||||
out=$(osc ${APIURL} -q co "${obs_pkg_name}" -o "${repo_dir}") || die "failed to checkout:$out"
|
||||
out=$(osc -q co "${obs_pkg_name}" -o "${repo_dir}") || die "failed to checkout:$out"
|
||||
|
||||
spec_file=$(find "${repo_dir}" -maxdepth 1 -type f -name '*.spec' | head -1)
|
||||
# Find in specfile in Release: XX field.
|
||||
release=$(grep -oP 'Release:\s+[0-9]+' "${spec_file}" | grep -oP '[0-9]+')
|
||||
|
||||
if [ -z "${release}" ]; then
|
||||
# Not release number found find in "%define release XX"
|
||||
release=$(grep -oP '%define\s+release\s+[0-9]+' "${spec_file}" | grep -oP '[0-9]+')
|
||||
fi
|
||||
|
||||
release_file=$(find "${repo_dir}" -maxdepth 1 -type f -name 'pkg-release')
|
||||
if [ -z "${release}" ] && [ -f "${release_file}" ]; then
|
||||
# Release still not found check pkg-release file
|
||||
release=$(grep -oP '[0-9]+' ${release_file})
|
||||
fi
|
||||
if [ -z "${release}" ]; then
|
||||
# Not release number found, this is a new repository.
|
||||
release=1
|
||||
fi
|
||||
|
||||
rm -r "${repo_dir}"
|
||||
echo "${release}"
|
||||
}
|
||||
|
@ -4,11 +4,7 @@
|
||||
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
|
||||
%global GO_VERSION @GO_VERSION@
|
||||
|
||||
%if 0%{?suse_version}
|
||||
%define LIBEXECDIR %{_libdir}
|
||||
%else
|
||||
%define LIBEXECDIR %{_libexecdir}
|
||||
%endif
|
||||
%define LIBEXECDIR /usr/libexec
|
||||
|
||||
%undefine _missing_build_ids_terminate_build
|
||||
Name: kata-shim
|
||||
@ -77,5 +73,6 @@ make install LIBEXECDIR=%{buildroot}%{LIBEXECDIR} COMMIT=@HASH@
|
||||
|
||||
%files bin
|
||||
%defattr(-,root,root,-)
|
||||
%{LIBEXECDIR}/kata-containers
|
||||
%dir %{LIBEXECDIR}
|
||||
%dir %{LIBEXECDIR}/kata-containers
|
||||
%{LIBEXECDIR}/kata-containers/kata-shim
|
||||
|
@ -9,7 +9,11 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Automation script to create specs to build kata-shim
|
||||
set -e
|
||||
[ -z "${DEBUG}" ] || set -o xtrace
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source ../versions.txt
|
||||
source ../scripts/pkglib.sh
|
||||
@ -29,7 +33,6 @@ cli "$@"
|
||||
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/shim}
|
||||
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
|
||||
((RELEASE++))
|
||||
[ -n "$APIURL" ] && APIURL="-A ${APIURL}"
|
||||
|
||||
set_versions $kata_shim_hash
|
||||
replace_list=(
|
||||
|
@ -1,32 +1,32 @@
|
||||
kata_agent_hash=7b458b18ffcbb90a1aed1644d109ea438f39c9a0
|
||||
kata_ksm_throttler_hash=1fecaffc98386fdb080979d38d5688566eec54a1
|
||||
kata_proxy_hash=8a305e5a61856c7510350b0ade5a5dc5e9255dbf
|
||||
kata_runtime_hash=bf1cf684f5d48d3142665f98daf719faf94039e2
|
||||
kata_shim_hash=de2d2a67659cab7928b81f836a8f64450c998453
|
||||
|
||||
# This is a generated file from gen_versions_txt.sh
|
||||
|
||||
kata_runtime_version=1.2.0
|
||||
kata_runtime_hash=0bcb32f7042625ea0ecee8f37b99b4459ebd5af8
|
||||
|
||||
kata_proxy_version=1.2.0
|
||||
kata_proxy_hash=17962180fc61c66066905546bfd5d8933bf73df1
|
||||
|
||||
kata_shim_version=1.2.0
|
||||
kata_shim_hash=0a37760c0224167143cb3cc920c78f5147f52e70
|
||||
|
||||
kata_agent_version=1.2.0
|
||||
kata_agent_hash=fcfa054a757e7c17afba47b0b4d7e91cbb8688ed
|
||||
|
||||
kata_ksm_throttler_version=1.2.0
|
||||
kata_ksm_throttler_hash=f232434f36b1b2c916eb6211118cf26671bd04ef
|
||||
|
||||
# Dependencies
|
||||
qemu_lite_hash=6ba2bfbee9a80bfd03605c5eb2ca743c8b68389e
|
||||
qemu_vanilla_hash=e3050471ff1daa7fefe88388dfa4e1d97ba1f0bc
|
||||
kata_osbuilder_version=1.2.0
|
||||
|
||||
kata_runtime_version=1.1.0
|
||||
kata_proxy_version=1.1.0
|
||||
kata_shim_version=1.1.0
|
||||
kata_agent_version=1.1.0
|
||||
kata_ksm_throttler_version=1.1.0
|
||||
kata_osbuilder_version=1.1.0
|
||||
qemu_lite_version=2.11.0
|
||||
qemu_vanilla_version=2.11
|
||||
qemu_lite_hash=a39e0b3e828ff6fb4457865ef7a021f1e7320c27
|
||||
|
||||
qemu_vanilla_version=2.11.2
|
||||
qemu_vanilla_hash=a39e0b3e828ff6fb4457865ef7a021f1e7320c27
|
||||
|
||||
kernel_version=4.14.51
|
||||
|
||||
# Default osbuilder image options
|
||||
osbuilder_default_os=clearlinux
|
||||
clearlinux_version=20640
|
||||
|
||||
# Default osbuilder initrd options
|
||||
osbuilder_default_initrd_os=alpine
|
||||
alpine_version=3.7
|
||||
|
||||
# Golang
|
||||
go_version=1.10.2
|
||||
# sha256 checksum for the go_version binary distribution ("go${go_version}.linux-amd64.tar.gz")
|
||||
go_checksum=4b677d698c65370afa33757b6954ade60347aaca310ea92a63ed717d7cb0c2ff
|
||||
|
169
release/kata-deploy-binaries.sh
Executable file
169
release/kata-deploy-binaries.sh
Executable file
@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[ -z "${DEBUG}" ] || set -x
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly project="kata-containers"
|
||||
readonly prefix="/opt/kata"
|
||||
readonly project_to_attach="github.com/${project}/runtime"
|
||||
readonly tmp_dir=$(mktemp -d -t static-build-tmp.XXXXXXXXXX)
|
||||
readonly GOPATH="${tmp_dir}/go"
|
||||
# flag to decide if push tarball to github
|
||||
push=false
|
||||
export GOPATH
|
||||
workdir="${WORKDIR:-$PWD}"
|
||||
|
||||
exit_handler() {
|
||||
[ -d "${tmp_dir}" ] || sudo rm -rf "${tmp_dir}"
|
||||
}
|
||||
trap exit_handler EXIT
|
||||
|
||||
projects=(
|
||||
proxy
|
||||
runtime
|
||||
shim
|
||||
)
|
||||
|
||||
die() {
|
||||
msg="$*"
|
||||
echo "ERROR: ${msg}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
info() {
|
||||
echo "INFO: $*"
|
||||
}
|
||||
|
||||
usage() {
|
||||
return_code=${1:-0}
|
||||
cat <<EOT
|
||||
This script is used as part of the ${project} release process.
|
||||
It is used to create a tarball with static binaries.
|
||||
|
||||
|
||||
Usage:
|
||||
${script_name} <options> [version]
|
||||
|
||||
Args:
|
||||
version: The kata version that will be use to create the tarball
|
||||
|
||||
options:
|
||||
|
||||
-h : Show this help
|
||||
-p : push tarball to ${project_to_attach}
|
||||
-w <dir>: directory where tarball will be created
|
||||
|
||||
|
||||
EOT
|
||||
|
||||
exit "${return_code}"
|
||||
}
|
||||
|
||||
#Install guest image/initrd asset
|
||||
install_image() {
|
||||
image_destdir="${destdir}/${prefix}/share/kata-containers/"
|
||||
info "Create image"
|
||||
image_tarball=$(find . -name 'kata-containers-'"${kata_version}"'-*.tar.gz')
|
||||
[ -f "${image_tarball}" ] || "${script_dir}/../obs-packaging/kata-containers-image/build_image.sh" -v "${kata_version}"
|
||||
image_tarball=$(find . -name 'kata-containers-'"${kata_version}"'-*.tar.gz')
|
||||
[ -f "${image_tarball}" ] || die "image not found"
|
||||
info "Install image in destdir ${image_tarball}"
|
||||
mkdir -p "${image_destdir}"
|
||||
tar xf "${image_tarball}" -C "${image_destdir}"
|
||||
pushd "${destdir}/${prefix}/share/kata-containers/" >>/dev/null
|
||||
info "Create image default symlinks"
|
||||
image=$(find . -name 'kata-containers-image*.img')
|
||||
initrd=$(find . -name 'kata-containers-initrd*.initrd')
|
||||
ln -sf "${image}" kata-containers.img
|
||||
ln -sf "${initrd}" kata-containers-initrd.img
|
||||
popd >>/dev/null
|
||||
}
|
||||
|
||||
#Install kernel asset
|
||||
install_kernel() {
|
||||
go get "github.com/${project}/packaging" || true
|
||||
pushd ${GOPATH}/src/github.com/${project}/packaging >>/dev/null
|
||||
git checkout "${kata_version}-kernel-config"
|
||||
popd >>/dev/null
|
||||
pushd "${script_dir}/../kernel" >>/dev/null
|
||||
|
||||
info "build kernel"
|
||||
./build-kernel.sh setup
|
||||
./build-kernel.sh build
|
||||
info "install kernel"
|
||||
DESTDIR="${destdir}" PREFIX="${prefix}" ./build-kernel.sh install
|
||||
popd >>/dev/null
|
||||
}
|
||||
|
||||
# Install static qemu asset
|
||||
install_qemu() {
|
||||
info "build static qemu"
|
||||
"${script_dir}/../static-build/qemu/build-static-qemu.sh"
|
||||
info "Install static qemu"
|
||||
tar xf kata-qemu-static.tar.gz -C "${destdir}"
|
||||
}
|
||||
|
||||
#Install all components that are not assets
|
||||
install_kata_components() {
|
||||
for p in "${projects[@]}"; do
|
||||
echo "Download ${p}"
|
||||
go get "github.com/${project}/$p" || true
|
||||
pushd "${GOPATH}/src/github.com/${project}/$p" >>/dev/null
|
||||
echo "Checkout to version ${kata_version}"
|
||||
git checkout "${kata_version}"
|
||||
echo "Build"
|
||||
make \
|
||||
PREFIX="${prefix}" \
|
||||
QEMUCMD="qemu-system-x86_64"
|
||||
#TODO Remove libexecdir
|
||||
echo "Install"
|
||||
make PREFIX="${prefix}" \
|
||||
DESTDIR="${destdir}" \
|
||||
LIBEXECDIR="/${destdir}/${prefix}/libexec/" \
|
||||
install
|
||||
popd >>/dev/null
|
||||
done
|
||||
sed -i -e '/^initrd =/d' "${destdir}/${prefix}/share/defaults/${project}/configuration.toml"
|
||||
}
|
||||
|
||||
main() {
|
||||
while getopts "hpw:" opt; do
|
||||
case $opt in
|
||||
h) usage 0 ;;
|
||||
p) push="true" ;;
|
||||
w) workdir="${OPTARG}" ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
kata_version=${1:-}
|
||||
[ -n "${kata_version}" ] || usage 1
|
||||
info "Requested version: ${kata_version}"
|
||||
|
||||
destdir="${workdir}/kata-static-${kata_version}-$(arch)"
|
||||
info "DESTDIR ${destdir}"
|
||||
mkdir -p "${destdir}"
|
||||
install_image
|
||||
install_kata_components
|
||||
install_kernel
|
||||
install_qemu
|
||||
tarball_name="${destdir}.tar.xz"
|
||||
pushd "${destdir}" >>/dev/null
|
||||
tar cfJ "${tarball_name}" "./opt"
|
||||
popd >>/dev/null
|
||||
if [ "${push}" == "true" ]; then
|
||||
hub -C "${GOPATH}/src/github.com/${project}/runtime" release edit -a "${tarball_name}" "${kata_version}"
|
||||
else
|
||||
echo "Wont push the tarball to github use -p option to do it."
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
70
release/publish-kata-image.sh
Executable file
70
release/publish-kata-image.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
#Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
#SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[ -z "${DEBUG}" ] || set -x
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
workdir="${PWD}"
|
||||
|
||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly project="kata-containers"
|
||||
GOPATH=${GOPATH:-${HOME}/go}
|
||||
|
||||
die() {
|
||||
msg="$*"
|
||||
echo "ERROR: ${FUNCNAME[1]} ${msg}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
return_code=${1:-0}
|
||||
cat <<EOT
|
||||
Usage:
|
||||
|
||||
${script_name} [options] <version>
|
||||
|
||||
version: Kata version to create the image.
|
||||
|
||||
Create image for a kata version.
|
||||
|
||||
options:
|
||||
|
||||
-h : show this help
|
||||
-p : push image to github
|
||||
EOT
|
||||
|
||||
exit "${return_code}"
|
||||
}
|
||||
|
||||
main() {
|
||||
push="false"
|
||||
while getopts "d:hp" opt; do
|
||||
case $opt in
|
||||
h) usage 0 ;;
|
||||
p) push="true" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
kata_version=${1:-}
|
||||
[ -n "${kata_version}" ] || usage "1"
|
||||
|
||||
image_tarball=$(find -name 'kata-containers-*.tar.gz' | grep "${kata_version}") ||
|
||||
"${script_dir}/../obs-packaging/kata-containers-image/build_image.sh" -v "${kata_version}"
|
||||
image_tarball=$(find -name 'kata-containers-*.tar.gz' | grep "${kata_version}") || die "file not found ${image_tarball}"
|
||||
|
||||
if [ ${push} == "true" ]; then
|
||||
hub -C "${GOPATH}/src/github.com/${project}/agent" release edit -a "${image_tarball}" "${kata_version}"
|
||||
else
|
||||
echo "Wont push image to github use -p option to do it."
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
@ -34,6 +34,9 @@ typeset -a qemu_options
|
||||
|
||||
typeset -A recognised_tags
|
||||
|
||||
# Prefix were kata will be installed
|
||||
prefix=${PREFIX:-/usr}
|
||||
|
||||
recognised_tags=(
|
||||
[arch]="architecture-specific"
|
||||
[functionality]="required functionality"
|
||||
@ -402,14 +405,17 @@ generate_qemu_options()
|
||||
|
||||
unset _qemu_ldflags
|
||||
|
||||
# Where to install qemu helper binaries
|
||||
qemu_options+=(misc:--prefix=${prefix})
|
||||
|
||||
# Where to install qemu libraries
|
||||
qemu_options+=(arch:--libdir=/usr/lib64/${hypervisor})
|
||||
qemu_options+=(arch:--libdir=${prefix}/lib/${hypervisor})
|
||||
|
||||
# Where to install qemu helper binaries
|
||||
qemu_options+=(misc:--libexecdir=/usr/libexec/${hypervisor})
|
||||
qemu_options+=(misc:--libexecdir=${prefix}/libexec/${hypervisor})
|
||||
|
||||
# Where to install data files
|
||||
qemu_options+=(misc:--datadir=/usr/share/${hypervisor})
|
||||
qemu_options+=(misc:--datadir=${prefix}/share/${hypervisor})
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,16 +31,16 @@ install_yq() {
|
||||
}
|
||||
|
||||
get_from_kata_deps(){
|
||||
dependency="$1"
|
||||
local dependency="$1"
|
||||
local branch="${2:-master}"
|
||||
local runtime_repo="github.com/kata-containers/runtime"
|
||||
GOPATH=${GOPATH:-${HOME}/go}
|
||||
# This is needed in order to retrieve the version for qemu-lite
|
||||
install_yq >&2
|
||||
runtime_repo="github.com/kata-containers/runtime"
|
||||
runtime_repo_dir="$GOPATH/src/${runtime_repo}"
|
||||
versions_file="${runtime_repo_dir}/versions.yaml"
|
||||
mkdir -p $(dirname "${runtime_repo_dir}")
|
||||
[ -d "${runtime_repo_dir}" ] || git clone --quiet https://${runtime_repo}.git "${runtime_repo_dir}"
|
||||
[ ! -f "$versions_file" ] && { echo >&2 "ERROR: cannot find $versions_file"; exit 1; }
|
||||
yaml_url="https://raw.githubusercontent.com/kata-containers/runtime/${branch}/versions.yaml"
|
||||
versions_file="versions_${branch}.yaml"
|
||||
[ ! -e "${versions_file}" ] || download_on_new_flag="-z ${versions_file}"
|
||||
curl --silent -o "${versions_file}" ${download_on_new_flag:-} "$yaml_url"
|
||||
result=$("${GOPATH}/bin/yq" read "$versions_file" "$dependency")
|
||||
[ "$result" = "null" ] && result=""
|
||||
echo "$result"
|
||||
|
@ -39,7 +39,9 @@ RUN git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
|
||||
|
||||
ADD configure-hypervisor.sh /root/configure-hypervisor.sh
|
||||
|
||||
RUN /root/configure-hypervisor.sh -s kata-qemu | xargs ./configure --prefix=/opt/kata --with-pkgversion=kata-static
|
||||
RUN PREFIX=/opt/kata /root/configure-hypervisor.sh -s kata-qemu | xargs ./configure \
|
||||
--with-pkgversion=kata-static
|
||||
|
||||
RUN make clean
|
||||
RUN make -j$(nproc)
|
||||
RUN make install DESTDIR=/tmp/qemu-static
|
||||
|
Loading…
Reference in New Issue
Block a user