Merge pull request #418 from bergwolf/packaging

packaging: adjustment for 2.0 branch
This commit is contained in:
Fupan Li 2020-09-01 11:06:34 +08:00 committed by GitHub
commit 8df06a046e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 480 additions and 1016 deletions

View File

@ -0,0 +1,34 @@
#!/bin/bash
# Copyright (c) 2019 Intel Corporation
# Copyright (c) 2020 Ant Group
#
# SPDX-License-Identifier: Apache-2.0
#
set -o errexit
set -o pipefail
main() {
artifact_stage=${1:-}
artifact=$(echo ${artifact_stage} | sed -n -e 's/^install_//p' | sed -r 's/_/-/g')
if [ -z "${artifact}" ]; then
"Scripts needs artifact name to build"
exit 1
fi
tag=$(echo $GITHUB_REF | cut -d/ -f3-)
pushd $GITHUB_WORKSPACE/tools/packaging/obs-packaging
git checkout $tag
./gen_versions_txt.sh $tag
popd
pushd $GITHUB_WORKSPACE/tools/packaging/release
source ./kata-deploy-binaries.sh
${artifact_stage} $tag
popd
mv $GITHUB_WORKSPACE/tools/packaging/release/kata-static-${artifact}.tar.gz .
}
main $@

View File

@ -2,7 +2,7 @@ name: Publish release tarball
on: on:
push: push:
tags: tags:
- '*' - '1.*'
jobs: jobs:
get-artifact-list: get-artifact-list:
@ -10,12 +10,11 @@ jobs:
steps: steps:
- name: get the list - name: get the list
run: | run: |
git clone https://github.com/kata-containers/packaging pushd $GITHUB_WORKSPACE
pushd packaging
tag=$(echo $GITHUB_REF | cut -d/ -f3-) tag=$(echo $GITHUB_REF | cut -d/ -f3-)
git checkout $tag git checkout $tag
popd popd
./packaging/artifact-list.sh > artifact-list.txt $GITHUB_WORKSPACE/tools/packaging/artifact-list.sh > artifact-list.txt
- name: save-artifact-list - name: save-artifact-list
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
with: with:

321
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,321 @@
name: Publish Kata 2.x release artifacts
on:
push:
tags:
- '2.*'
jobs:
get-artifact-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get the list
run: |
pushd $GITHUB_WORKSPACE
tag=$(echo $GITHUB_REF | cut -d/ -f3-)
git checkout $tag
popd
$GITHUB_WORKSPACE/tools/packaging/artifact-list.sh > artifact-list.txt
- name: save-artifact-list
uses: actions/upload-artifact@v2
with:
name: artifact-list
path: artifact-list.txt
build-kernel:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_kernel"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- run: |
sudo apt-get update && sudo apt install -y flex bison libelf-dev bc iptables
- name: build-kernel
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-kernel.tar.gz
build-experimental-kernel:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_experimental_kernel"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- run: |
sudo apt-get update && sudo apt install -y flex bison libelf-dev bc iptables
- name: build-experimental-kernel
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-experimental-kernel.tar.gz
build-qemu:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_qemu"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- name: build-qemu
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-qemu.tar.gz
build-qemu-virtiofsd:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_qemu_virtiofsd"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- name: build-qemu-virtiofsd
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-qemu-virtiofsd.tar.gz
build-image:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_image"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- name: build-image
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-image.tar.gz
build-firecracker:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_firecracker"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- name: build-firecracker
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-firecracker.tar.gz
build-clh:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_clh"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- name: build-clh
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-clh.tar.gz
build-kata-components:
runs-on: ubuntu-16.04
needs: get-artifact-list
env:
buildstr: "install_kata_components"
steps:
- uses: actions/checkout@v2
- name: get-artifact-list
uses: actions/download-artifact@v2
with:
name: artifact-list
- name: build-kata-components
run: |
if grep -q $buildstr artifact-list.txt; then
$GITHUB_WORKSPACE/.github/workflows/generate-local-artifact-tarball.sh $buildstr
echo ::set-env name=artifact-built::true
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@v2
with:
name: kata-artifacts
path: kata-static-kata-components.tar.gz
gather-artifacts:
runs-on: ubuntu-16.04
needs: [build-experimental-kernel, build-kernel, build-qemu, build-qemu-virtiofsd, build-image, build-firecracker, build-kata-components, build-clh]
steps:
- uses: actions/checkout@v2
- name: get-artifacts
uses: actions/download-artifact@v2
with:
name: kata-artifacts
path: kata-artifacts
- name: colate-artifacts
run: |
$GITHUB_WORKSPACE/.github/workflows/gather-artifacts.sh
- name: store-artifacts
uses: actions/upload-artifact@v2
with:
name: release-candidate
path: kata-static.tar.xz
kata-deploy:
needs: gather-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get-artifacts
uses: actions/download-artifact@v2
with:
name: release-candidate
- name: build-and-push-kata-deploy-ci
id: build-and-push-kata-deploy-ci
run: |
tag=$(echo $GITHUB_REF | cut -d/ -f3-)
pushd $GITHUB_WORKSPACE
git checkout $tag
pkg_sha=$(git rev-parse HEAD)
popd
mv kata-static.tar.xz $GITHUB_WORKSPACE/tools/packaging/kata-deploy/kata-static.tar.xz
docker build --build-arg KATA_ARTIFACTS=kata-static.tar.xz -t katadocker/kata-deploy-ci:$pkg_sha $GITHUB_WORKSPACE/tools/packaging/kata-deploy
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push katadocker/kata-deploy-ci:$pkg_sha
echo "##[set-output name=PKG_SHA;]${pkg_sha}"
echo ::set-env name=TAG::$tag
mkdir -p packaging/kata-deploy
ln -s $GITHUB_WORKSPACE/tools/packaging/kata-deploy/action packaging/kata-deploy/action
- name: test-kata-deploy-ci-in-aks
uses: ./packaging/kata-deploy/action
with:
packaging-sha: ${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}}
env:
PKG_SHA: ${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}}
AZ_APPID: ${{ secrets.AZ_APPID }}
AZ_PASSWORD: ${{ secrets.AZ_PASSWORD }}
AZ_SUBSCRIPTION_ID: ${{ secrets.AZ_SUBSCRIPTION_ID }}
AZ_TENANT_ID: ${{ secrets.AZ_TENANT_ID }}
- name: push-tarball
run: |
# tag the container image we created and push to DockerHub
tag=$(echo $GITHUB_REF | cut -d/ -f3-)
docker tag katadocker/kata-deploy-ci:${{steps.build-and-push-kata-deploy-ci.outputs.PKG_SHA}} katadocker/kata-deploy:${tag}
docker push katadocker/kata-deploy:${tag}
upload-static-tarball:
needs: kata-deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: download-artifacts
uses: actions/download-artifact@v2
with:
name: release-candidate
- name: install hub
run: |
HUB_VER=$(curl -s "https://api.github.com/repos/github/hub/releases/latest" | jq -r .tag_name | sed 's/^v//')
wget -q -O- https://github.com/github/hub/releases/download/v$HUB_VER/hub-linux-amd64-$HUB_VER.tgz | \
tar xz --strip-components=2 --wildcards '*/bin/hub' && sudo mv hub /usr/local/bin/hub
- name: push static tarball to github
run: |
tag=$(echo $GITHUB_REF | cut -d/ -f3-)
tarball="kata-static-$tag-x86_64.tar.xz"
mv kata-static.tar.xz "$GITHUB_WORKSPACE/${tarball}"
pushd $GITHUB_WORKSPACE
echo "uploading asset '${tarball}' for tag: ${tag}"
GITHUB_TOKEN=${{ secrets.GIT_UPLOAD_TOKEN }} hub release edit -m "" -a "${tarball}" "${tag}"

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
**/*.orig **/*.orig
**/*.rej **/*.rej
**/target **/target
**/.vscode

23
ci/install_musl.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Copyright (c) 2020 Ant Group
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
install_aarch64_musl() {
local arch=$(uname -m)
if [ "${arch}" == "aarch64" ]; then
local musl_tar="${arch}-linux-musl-native.tgz"
local musl_dir="${arch}-linux-musl-native"
pushd /tmp
curl -sLO https://musl.cc/${musl_tar}
tar -zxf ${musl_tar}
mkdir -p /usr/local/musl/
cp -r ${musl_dir}/* /usr/local/musl/
popd
fi
}
install_aarch64_musl

View File

@ -63,7 +63,6 @@ function install_yq() {
curl -o "${yq_path}" -LSsf "${yq_url}" curl -o "${yq_path}" -LSsf "${yq_url}"
[ $? -ne 0 ] && die "Download ${yq_url} failed" [ $? -ne 0 ] && die "Download ${yq_url} failed"
chmod +x "${yq_path}" chmod +x "${yq_path}"
echo "Installed $(${yq_path} --version)"
if ! command -v "${yq_path}" >/dev/null; then if ! command -v "${yq_path}" >/dev/null; then
die "Cannot not get ${yq_path} executable" die "Cannot not get ${yq_path} executable"
@ -71,4 +70,3 @@ function install_yq() {
} }
install_yq install_yq

View File

@ -22,7 +22,7 @@ ifeq (,$(not_check_version))
have_yq=$(shell if [ -x "$(GOPATH)/bin/yq" ]; then echo "true"; else echo ""; fi) have_yq=$(shell if [ -x "$(GOPATH)/bin/yq" ]; then echo "true"; else echo ""; fi)
ifeq (,$(have_yq)) ifeq (,$(have_yq))
$(info INFO: yq was not found, installing it) $(info INFO: yq was not found, installing it)
install_yq=$(shell .ci/install-yq.sh) install_yq=$(shell ../../ci/install_yq.sh)
endif endif
ifneq (,$(install_yq)) ifneq (,$(install_yq))
$(error "ERROR: install yq failed") $(error "ERROR: install yq failed")

View File

@ -6,7 +6,7 @@
all: | update-yaml generate-client-code all: | update-yaml generate-client-code
MK_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) MK_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
YQ_INSTALLER := "$(MK_DIR)/../../../.ci/install-yq.sh" YQ_INSTALLER := "$(MK_DIR)/../../../../../ci/install_yq.sh"
VERSIONS_FILE := "$(MK_DIR)/../../../../../versions.yaml" VERSIONS_FILE := "$(MK_DIR)/../../../../../versions.yaml"
YQ := $(shell command -v yq 2> /dev/null) YQ := $(shell command -v yq 2> /dev/null)
@ -22,7 +22,7 @@ generate-client-code: clean-generated-code
update-yaml: update-yaml:
ifndef YQ ifndef YQ
$(MK_DIR)/../../../.ci/install-yq.sh $(MK_DIR)/../../../../../ci//install_yq.sh
endif endif
clh_version=$(shell yq r $(VERSIONS_FILE) assets.hypervisor.cloud_hypervisor.version); \ clh_version=$(shell yq r $(VERSIONS_FILE) assets.hypervisor.cloud_hypervisor.version); \
curl -OL https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/$$clh_version/vmm/src/api/openapi/cloud-hypervisor.yaml curl -OL https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/$$clh_version/vmm/src/api/openapi/cloud-hypervisor.yaml

View File

@ -13,6 +13,7 @@ DISTRO := centos
BUILD_METHOD := distro BUILD_METHOD := distro
BUILD_METHOD_LIST := distro dracut BUILD_METHOD_LIST := distro dracut
AGENT_INIT ?= no AGENT_INIT ?= no
USE_DOCKER ?= true
ROOTFS_BUILD_DEST := $(shell pwd) ROOTFS_BUILD_DEST := $(shell pwd)
IMAGES_BUILD_DEST := $(shell pwd) IMAGES_BUILD_DEST := $(shell pwd)
ROOTFS_MARKER_SUFFIX := _rootfs.done ROOTFS_MARKER_SUFFIX := _rootfs.done

View File

@ -3,39 +3,9 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
From docker.io/golang:@GO_VERSION@-alpine From docker.io/alpine:3.11.6
RUN apk update && apk add \ RUN apk update && apk add \
apk-tools-static \ bash \
autoconf \ coreutils \
automake \ binutils
bash \
binutils \
cmake \
coreutils \
curl \
g++ \
gcc \
git \
libc-dev \
libseccomp \
libseccomp-dev \
linux-headers \
m4 \
make \
musl \
musl-dev \
tar \
vim
# alpine doesn't support x86_64-unknown-linux-gnu
# It only support x86_64-unknown-linux-musl. Even worse,
# it doesn't support proc-macro, which is needed for serde_derive
#
# See issue: https://github.com/kata-containers/osbuilder/issues/386
# -- FIXME
#
# Thus, we cannot build rust agent on alpine
# The way to use alpine is to generate rootfs or build
# go agent to get rootfs and then cp rust agent to rootfs.
# pity..
# RUN ln -svf /usr/bin/gcc /bin/musl-gcc; ln -svf /usr/bin/g++ /bin/musl-g++

View File

@ -13,9 +13,7 @@ BASE_PACKAGES="alpine-base"
# See a list of mirrors at http://nl.alpinelinux.org/alpine/MIRRORS.txt # See a list of mirrors at http://nl.alpinelinux.org/alpine/MIRRORS.txt
MIRROR=http://dl-5.alpinelinux.org/alpine MIRROR=http://dl-5.alpinelinux.org/alpine
# Mandatory Packages that must be installed PACKAGES=""
# - iptables: Need by Kata agent
PACKAGES="iptables"
# Init process must be one of {systemd,kata-agent} # Init process must be one of {systemd,kata-agent}
INIT_PROCESS=kata-agent INIT_PROCESS=kata-agent

View File

@ -9,8 +9,6 @@
# #
# - Optional environment variables # - Optional environment variables
# #
# EXTRA_PKGS: Variable to add extra PKGS provided by the user
#
# BIN_AGENT: Name of the Kata-Agent binary # BIN_AGENT: Name of the Kata-Agent binary
# #
# Any other configuration variable for a specific distro must be added # Any other configuration variable for a specific distro must be added
@ -24,21 +22,13 @@ build_rootfs() {
# Mandatory # Mandatory
local ROOTFS_DIR=$1 local ROOTFS_DIR=$1
# In case of support EXTRA packages, use it to allow
# users add more packages to the base rootfs
local EXTRA_PKGS=${EXTRA_PKGS:-}
# Populate ROOTFS_DIR # Populate ROOTFS_DIR
check_root check_root
mkdir -p "${ROOTFS_DIR}" mkdir -p "${ROOTFS_DIR}"
/sbin/apk.static \ rm -rf ${ROOTFS_DIR}/var/tmp
-X ${MIRROR}/${OS_VERSION}/main \ cp -a -r -f /bin /etc /lib /sbin /usr /var ${ROOTFS_DIR}
-U \ mkdir -p ${ROOTFS_DIR}{/root,/proc,/dev,/home,/media,/mnt,/opt,/run,/srv,/sys,/tmp}
--allow-untrusted \
--root ${ROOTFS_DIR}\
--initdb add ${BASE_PACKAGES} ${EXTRA_PKGS} ${PACKAGES}
mkdir -p ${ROOTFS_DIR}{/root,/etc/apk,/proc}
echo "${MIRROR}/${OS_VERSION}/main" > ${ROOTFS_DIR}/etc/apk/repositories echo "${MIRROR}/${OS_VERSION}/main" > ${ROOTFS_DIR}/etc/apk/repositories
} }

View File

@ -15,7 +15,7 @@ script_dir="$(dirname $(readlink -f $0))"
AGENT_VERSION=${AGENT_VERSION:-} AGENT_VERSION=${AGENT_VERSION:-}
GO_AGENT_PKG=${GO_AGENT_PKG:-github.com/kata-containers/agent} GO_AGENT_PKG=${GO_AGENT_PKG:-github.com/kata-containers/agent}
RUST_AGENT_PKG=${RUST_AGENT_PKG:-github.com/kata-containers/kata-containers} RUST_AGENT_PKG=${RUST_AGENT_PKG:-github.com/kata-containers/kata-containers}
RUST_AGENT=${RUST_AGENT:-no} RUST_AGENT=${RUST_AGENT:-yes}
RUST_VERSION="null" RUST_VERSION="null"
CMAKE_VERSION=${CMAKE_VERSION:-"null"} CMAKE_VERSION=${CMAKE_VERSION:-"null"}
MUSL_VERSION=${MUSL_VERSION:-"null"} MUSL_VERSION=${MUSL_VERSION:-"null"}
@ -288,6 +288,7 @@ check_env_variables()
# Builds a rootfs based on the distro name provided as argument # Builds a rootfs based on the distro name provided as argument
build_rootfs_distro() build_rootfs_distro()
{ {
repo_dir="${script_dir}/../../../"
[ -n "${distro}" ] || usage 1 [ -n "${distro}" ] || usage 1
distro_config_dir="${script_dir}/${distro}" distro_config_dir="${script_dir}/${distro}"
@ -346,21 +347,8 @@ build_rootfs_distro()
if [ -z "${USE_DOCKER}" ] && [ -z "${USE_PODMAN}" ]; then if [ -z "${USE_DOCKER}" ] && [ -z "${USE_PODMAN}" ]; then
#Generate an error if the local Go version is too old #Generate an error if the local Go version is too old
foundVersion=$(go version | sed -E "s/^.+([0-9]+\.[0-9]+\.[0-9]+).*$/\1/g") info "build directly"
build_rootfs ${ROOTFS_DIR}
compare_versions "${GO_VERSION}" "${foundVersion}" || \
die "Your Go version ${foundVersion} is older than the minimum expected Go version ${GO_VERSION}"
if [ "${RUST_AGENT}" == "yes" ]; then
source "${HOME}/.cargo/env"
foundVersion=$(rustc --version | sed -E "s/^.+([0-9]+\.[0-9]+\.[0-9]+).*$/\1/g")
compare_versions "${RUST_VERSION}" "${foundVersion}" || \
die "Your rust version ${foundVersion} is older than the minimum expected rust version ${RUST_VERSION}"
foundVersion=$(cmake --version | grep "[0-9]\+.[0-9]\+.[0-9]\+" | sed -E "s/^.+([0-9]+\.[0-9]+\.[0-9]+).*$/\1/g")
fi
else else
if [ -n "${USE_DOCKER}" ]; then if [ -n "${USE_DOCKER}" ]; then
container_engine="docker" container_engine="docker"
@ -394,6 +382,7 @@ build_rootfs_distro()
else else
docker_run_args+=" --env AGENT_SOURCE_BIN=${AGENT_SOURCE_BIN}" docker_run_args+=" --env AGENT_SOURCE_BIN=${AGENT_SOURCE_BIN}"
docker_run_args+=" -v ${AGENT_SOURCE_BIN}:${AGENT_SOURCE_BIN}" docker_run_args+=" -v ${AGENT_SOURCE_BIN}:${AGENT_SOURCE_BIN}"
docker_run_args+=" -v ${GOPATH_LOCAL}:${GOPATH_LOCAL} --env GOPATH=${GOPATH_LOCAL}"
fi fi
docker_run_args+=" $(docker_extra_args $distro)" docker_run_args+=" $(docker_extra_args $distro)"
@ -427,19 +416,16 @@ build_rootfs_distro()
--env INSIDE_CONTAINER=1 \ --env INSIDE_CONTAINER=1 \
--env SECCOMP="${SECCOMP}" \ --env SECCOMP="${SECCOMP}" \
--env DEBUG="${DEBUG}" \ --env DEBUG="${DEBUG}" \
--env STAGE_PREPARE_ROOTFS=1 \
--env HOME="/root" \ --env HOME="/root" \
-v "${script_dir}":"/osbuilder" \ -v "${repo_dir}":"/kata-containers" \
-v "${ROOTFS_DIR}":"/rootfs" \ -v "${ROOTFS_DIR}":"/rootfs" \
-v "${script_dir}/../scripts":"/scripts" \ -v "${script_dir}/../scripts":"/scripts" \
-v "${kernel_mod_dir}":"${kernel_mod_dir}" \ -v "${kernel_mod_dir}":"${kernel_mod_dir}" \
$docker_run_args \ $docker_run_args \
${image_name} \ ${image_name} \
bash /osbuilder/rootfs.sh "${distro}" bash /kata-containers/tools/osbuilder/rootfs-builder/rootfs.sh "${distro}"
exit $?
fi fi
build_rootfs ${ROOTFS_DIR}
} }
# Used to create a minimal directory tree where the agent can be instaleld. # Used to create a minimal directory tree where the agent can be instaleld.
@ -553,23 +539,16 @@ EOT
AGENT_DEST="${AGENT_DIR}/${AGENT_BIN}" AGENT_DEST="${AGENT_DIR}/${AGENT_BIN}"
if [ -z "${AGENT_SOURCE_BIN}" ] ; then if [ -z "${AGENT_SOURCE_BIN}" ] ; then
if [ "$RUST_AGENT" != "yes" ]; then bash ${script_dir}/../../../ci/install_musl.sh
agent_pkg="${GO_AGENT_PKG}" # rust agent needs ${arch}-unknown-linux-musl
agent_dir="${GOPATH_LOCAL}/src/${GO_AGENT_PKG}" rustup show | grep linux-musl > /dev/null || bash ${script_dir}/../../../ci/install_rust.sh
else test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env"
# The PATH /.cargo/bin is apparently wrong [ "$ARCH" == "aarch64" ] && OLD_PATH=$PATH && export PATH=$PATH:/usr/local/musl/bin
# looks like $HOME is resolved to empty when
# container is started
source "${HOME}/.cargo/env"
agent_pkg="${RUST_AGENT_PKG}"
agent_dir="${GOPATH_LOCAL}/src/${RUST_AGENT_PKG}/src/agent"
# For now, rust-agent doesn't support seccomp yet.
SECCOMP="no"
fi
info "Pull Agent source code" agent_pkg="${RUST_AGENT_PKG}"
go get -d "${agent_pkg}" || true agent_dir="${script_dir}/../../../src/agent/"
OK "Pull Agent source code" # For now, rust-agent doesn't support seccomp yet.
SECCOMP="no"
info "Build agent" info "Build agent"
pushd "${agent_dir}" pushd "${agent_dir}"
@ -577,6 +556,7 @@ EOT
make clean make clean
make LIBC=${LIBC} INIT=${AGENT_INIT} make LIBC=${LIBC} INIT=${AGENT_INIT}
make install DESTDIR="${ROOTFS_DIR}" LIBC=${LIBC} INIT=${AGENT_INIT} SECCOMP=${SECCOMP} make install DESTDIR="${ROOTFS_DIR}" LIBC=${LIBC} INIT=${AGENT_INIT} SECCOMP=${SECCOMP}
[ "$ARCH" == "aarch64" ] && export PATH=$OLD_PATH && rm -rf /usr/local/musl
popd popd
else else
cp ${AGENT_SOURCE_BIN} ${AGENT_DEST} cp ${AGENT_SOURCE_BIN} ${AGENT_DEST}
@ -624,18 +604,10 @@ parse_arguments()
distro="$1" distro="$1"
arch=$(uname -m) arch=$(uname -m)
if [ "${distro}" == "alpine" ]; then
if [ "${RUST_AGENT}" == "yes" ]; then
die "rust agent cannot be built on ${distro}.
alpine: only has stable/nightly-x86_64-unknown-linux-musl toolchain. It does not support proc-macro compilation.
See issue: https://github.com/kata-containers/osbuilder/issues/386"
fi
fi
if [ "${RUST_AGENT}" == "yes" ] && [ "${arch}" == "s390x" ]; then if [ "${RUST_AGENT}" == "yes" ] && [ "${arch}" == "s390x" ]; then
die "Cannot build rust agent on ppc64le. die "Cannot build rust agent on s390x
musl cannot be built on ppc64le because of long double musl cannot be built on s390x because of long double
reprentation is broken. And rust has no musl target on ppc64le. reprentation is broken. And rust has no musl target on s390x.
See issue: https://github.com/kata-containers/osbuilder/issues/388" See issue: https://github.com/kata-containers/osbuilder/issues/388"
fi fi
} }
@ -673,8 +645,10 @@ main()
prepare_overlay prepare_overlay
fi fi
init="${ROOTFS_DIR}/sbin/init" if [ "$STAGE_PREPARE_ROOTFS" == "" ]; then
setup_rootfs init="${ROOTFS_DIR}/sbin/init"
setup_rootfs
fi
} }
main $* main $*

View File

@ -7,15 +7,11 @@
set -e set -e
KATA_REPO=${KATA_REPO:-github.com/kata-containers/kata-containers} KATA_REPO=${KATA_REPO:-github.com/kata-containers/kata-containers}
KATA_REPO_DIR="${GOPATH}/src/${KATA_REPO}"
CMAKE_VERSION=${CMAKE_VERSION:-"null"} CMAKE_VERSION=${CMAKE_VERSION:-"null"}
MUSL_VERSION=${MUSL_VERSION:-"null"} MUSL_VERSION=${MUSL_VERSION:-"null"}
#https://github.com/kata-containers/tests/blob/master/.ci/jenkins_job_build.sh
# Give preference to variable set by CI # Give preference to variable set by CI
KATA_BRANCH=${branch:-} yq_file="${script_dir}/../../../ci/install_yq.sh"
KATA_BRANCH=${KATA_BRANCH:-master} kata_versions_file="${script_dir}/../../../versions.yaml"
yq_file="${script_dir}/../scripts/install-yq.sh"
kata_versions_file="${KATA_REPO_DIR}/versions.yaml"
error() error()
{ {
@ -199,7 +195,7 @@ create_summary_file()
if [ "${RUST_AGENT}" == "no" ]; then if [ "${RUST_AGENT}" == "no" ]; then
agent_version=$("$agent" --version|awk '{print $NF}') agent_version=$("$agent" --version|awk '{print $NF}')
else else
local -r agentdir="${GOPATH}/src/${KATA_REPO}/src/agent" local -r agentdir="${script_dir}/../../../"
agent_version=$(cat ${agentdir}/VERSION) agent_version=$(cat ${agentdir}/VERSION)
fi fi

View File

@ -57,7 +57,7 @@ function waitForLabelRemoval() {
} }
function run_test() { function run_test() {
YAMLPATH="./kata-deploy" YAMLPATH="./tools/packaging/kata-deploy/"
echo "verify connectivity with a pod using Kata" echo "verify connectivity with a pod using Kata"
deployment="" deployment=""
@ -97,20 +97,20 @@ function test_kata() {
[[ -z "$PKG_SHA" ]] && die "no PKG_SHA provided" [[ -z "$PKG_SHA" ]] && die "no PKG_SHA provided"
YAMLPATH="./tools/packaging/kata-deploy/"
# This action could be called in two contexts: # This action could be called in two contexts:
# 1. Packaging workflows: testing in packaging repository, where we assume yaml/packaging # 1. Packaging workflows: testing in packaging repository, where we assume yaml/packaging
# bits under test are already part of teh action workspace. # bits under test are already part of teh action workspace.
# 2. From kata-containers: when creating a release, the appropriate packaging repository is # 2. From kata-containers: when creating a release, the appropriate packaging repository is
# not yet part of the workspace, and we will need to clone # not yet part of the workspace, and we will need to clone
if [[ ! -d ./kata-deploy ]]; then if [[ ! -d $YAMLPATH ]]; then
[[ -d packaging ]] || git clone https://github.com/kata-containers/packaging packaging [[ -d $YAMLPATH ]] || git clone https://github.com/kata-containers/kata-containers
cd packaging cd kata-containers
git fetch git fetch
git checkout $PKG_SHA git checkout $PKG_SHA
fi fi
YAMLPATH="./kata-deploy"
kubectl apply -f "$YAMLPATH/kata-rbac/base/kata-rbac.yaml" kubectl apply -f "$YAMLPATH/kata-rbac/base/kata-rbac.yaml"
# apply runtime classes: # apply runtime classes:

View File

@ -27,18 +27,16 @@ kernel_version=""
# Flag know if need to download the kernel source # Flag know if need to download the kernel source
download_kernel=false download_kernel=false
# The repository where kernel configuration lives # The repository where kernel configuration lives
runtime_repository="github.com/${project_name}/runtime"
# The repository where kernel configuration lives
readonly kernel_config_repo="github.com/${project_name}/kata-containers/tools/packaging" readonly kernel_config_repo="github.com/${project_name}/kata-containers/tools/packaging"
readonly patches_repo="github.com/${project_name}/kata-containers/tools/packaging" readonly patches_repo="github.com/${project_name}/kata-containers/tools/packaging"
readonly patches_repo_dir="${GOPATH}/src/${patches_repo}" readonly patches_repo_dir="${GOPATH}/src/${patches_repo}"
# Default path to search patches to apply to kernel # Default path to search patches to apply to kernel
readonly default_patches_dir="${patches_repo_dir}/kernel/patches/" readonly default_patches_dir="${script_dir}/patches/"
# Default path to search config for kata # Default path to search config for kata
readonly default_kernel_config_dir="${GOPATH}/src/${kernel_config_repo}/kernel/configs" readonly default_kernel_config_dir="${script_dir}/configs"
# Default path to search for kernel config fragments # Default path to search for kernel config fragments
readonly default_config_frags_dir="${GOPATH}/src/${kernel_config_repo}/kernel/configs/fragments" readonly default_config_frags_dir="${script_dir}/configs/fragments"
readonly default_config_whitelist="${GOPATH}/src/${kernel_config_repo}/kernel/configs/fragments/whitelist.conf" readonly default_config_whitelist="${script_dir}/configs/fragments/whitelist.conf"
# GPU vendor # GPU vendor
readonly GV_INTEL="intel" readonly GV_INTEL="intel"
readonly GV_NVIDIA="nvidia" readonly GV_NVIDIA="nvidia"
@ -291,16 +289,6 @@ get_default_kernel_config() {
get_config_and_patches() { get_config_and_patches() {
if [ -z "${patches_path}" ]; then if [ -z "${patches_path}" ]; then
patches_path="${default_patches_dir}" patches_path="${default_patches_dir}"
if [ ! -d "${patches_path}" ]; then
tag="${kata_version}"
git clone -q "https://${patches_repo}.git" "${patches_repo_dir}"
pushd "${patches_repo_dir}" >> /dev/null
if [ -n $tag ] ; then
info "checking out $tag"
git checkout -q $tag
fi
popd >> /dev/null
fi
fi fi
} }

View File

@ -7,3 +7,4 @@ CONFIG_NF_NAT_PROTO_GRE
CONFIG_NF_NAT_PROTO_SCTP CONFIG_NF_NAT_PROTO_SCTP
CONFIG_NF_NAT_PROTO_UDPLITE CONFIG_NF_NAT_PROTO_UDPLITE
CONFIG_REFCOUNT_FULL CONFIG_REFCOUNT_FULL
CONFIG_MEMCG_SWAP_ENABLED

View File

@ -1,49 +0,0 @@
From c7ec155ec5e0f573e9c3cc4eb38d47543a2f1e81 Mon Sep 17 00:00:00 2001
From: Sebastien Boeuf <sebastien.boeuf@intel.com>
Date: Thu, 13 Feb 2020 08:50:38 +0100
Subject: [PATCH] net: virtio_vsock: Fix race condition between bind and listen
Whenever the vsock backend on the host sends a packet through the RX
queue, it expects an answer on the TX queue. Unfortunately, there is one
case where the host side will hang waiting for the answer and will
effectively never recover.
This issue happens when the guest side starts binding to the socket,
which insert a new bound socket into the list of already bound sockets.
At this time, we expect the guest to also start listening, which will
trigger the sk_state to move from TCP_CLOSE to TCP_LISTEN. The problem
occurs if the host side queued a RX packet and triggered an interrupt
right between the end of the binding process and the beginning of the
listening process. In this specific case, the function processing the
packet virtio_transport_recv_pkt() will find a bound socket, which means
it will hit the switch statement checking for the sk_state, but the
state won't be changed into TCP_LISTEN yet, which leads the code to pick
the default statement. This default statement will only free the buffer,
while it should also respond to the host side, by sending a packet on
its TX queue.
In order to simply fix this unfortunate chain of events, it is important
that in case the default statement is entered, and because at this stage
we know the host side is waiting for an answer, we must send back a
packet containing the operation VIRTIO_VSOCK_OP_RST.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
---
net/vmw_vsock/virtio_transport_common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 6f1a8aff65c5..0b6fb687a3e0 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -1048,6 +1048,7 @@ void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt)
virtio_transport_free_pkt(pkt);
break;
default:
+ (void)virtio_transport_reset_no_sock(t, pkt);
virtio_transport_free_pkt(pkt);
break;
}
--
2.20.1

View File

@ -49,5 +49,5 @@ echo "$commit"
agent_repository="github.com/kata-containers/agent" agent_repository="github.com/kata-containers/agent"
tarball_name="kata-containers-${version}-${commit:0:${short_commit_length}}-$(uname -m).tar.gz" tarball_name="kata-containers-${version}-${commit:0:${short_commit_length}}-$(uname -m).tar.gz"
image_url="https://${agent_repository}/releases/download/${version}/${tarball_name}" image_url="https://${agent_repository}/releases/download/${version}/${tarball_name}"
curl -OL "${image_url}" #curl -OL "${image_url}"
tar xvf "${tarball_name}" #tar xvf "${tarball_name}"

View File

@ -20,8 +20,7 @@ source "${script_dir}/../scripts/lib.sh"
ARCH=${ARCH:-$(arch_to_golang "$(uname -m)")} ARCH=${ARCH:-$(arch_to_golang "$(uname -m)")}
get_kata_version() { get_kata_version() {
local branch="$1" cat "${script_dir}/../../../VERSION"
curl -SsL "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION"
} }
gen_version_file() { gen_version_file() {
@ -36,12 +35,6 @@ gen_version_file() {
ref="refs/tags/${kata_version}^{}" ref="refs/tags/${kata_version}^{}"
fi fi
kata_runtime_hash=$(get_kata_hash "runtime" "${ref}")
kata_proxy_hash=$(get_kata_hash "proxy" "${ref}")
kata_shim_hash=$(get_kata_hash "shim" "${ref}")
kata_agent_hash=$(get_kata_hash "agent" "${ref}")
kata_ksm_throttler_hash=$(get_kata_hash "ksm-throttler" "${ref}")
qemu_vanilla_branch=$(get_from_kata_deps "assets.hypervisor.qemu.version" "${kata_version}") qemu_vanilla_branch=$(get_from_kata_deps "assets.hypervisor.qemu.version" "${kata_version}")
# Check if qemu.version can be used to get the version and hash, otherwise use qemu.tag # Check if qemu.version can be used to get the version and hash, otherwise use qemu.tag
qemu_vanilla_ref="refs/heads/${qemu_vanilla_branch}" qemu_vanilla_ref="refs/heads/${qemu_vanilla_branch}"
@ -57,32 +50,16 @@ gen_version_file() {
kernel_version=${kernel_version#v} kernel_version=${kernel_version#v}
golang_version=$(get_from_kata_deps "languages.golang.meta.newest-version" "${kata_version}") golang_version=$(get_from_kata_deps "languages.golang.meta.newest-version" "${kata_version}")
golang_sha256=$(curl -s -L "https://storage.googleapis.com/golang/go${golang_version}.linux-${ARCH}.tar.gz.sha256")
# - is not a valid char for rpmbuild # - is not a valid char for rpmbuild
# see https://github.com/semver/semver/issues/145 # see https://github.com/semver/semver/issues/145
kata_version=$(get_kata_version "${branch}") kata_version=$(get_kata_version)
kata_version=${kata_version/-/\~} kata_version=${kata_version/-/\~}
cat > "$versions_txt" <<EOT cat > "$versions_txt" <<EOT
# This is a generated file from ${script_name} # This is a generated file from ${script_name}
kata_version=${kata_version} kata_version=${kata_version}
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 # Dependencies
kata_osbuilder_version=${kata_version} kata_osbuilder_version=${kata_version}
@ -93,7 +70,6 @@ kernel_version=${kernel_version}
# Golang # Golang
go_version=${golang_version} go_version=${golang_version}
go_checksum=${golang_sha256}
EOT EOT
} }
@ -164,11 +140,11 @@ main() {
[ -n "${tag}" ] || die "No tag specified" "1" [ -n "${tag}" ] || die "No tag specified" "1"
# use the runtime's repository to determine branch information # use the runtime's repository to determine branch information
local repo="github.com/kata-containers/runtime" local repo="github.com/kata-containers/kata-containers"
local repo_dir="runtime" local repo_dir="kata-containers"
git clone --quiet "https://${repo}.git" "${repo_dir}" git clone --quiet "https://${repo}.git" "${repo_dir}"
pushd "${repo_dir}" >> /dev/null pushd "${repo_dir}" >> /dev/null
local branch=$(git branch -r -q --contains "${tag}" | grep -E "master|stable" | grep -v HEAD) local branch=$(git branch -r -q --contains "${tag}" | grep -E "master|stable|2.0-dev" | grep -v HEAD)
popd >> /dev/null popd >> /dev/null
rm -rf ${repo_dir} rm -rf ${repo_dir}
@ -191,7 +167,7 @@ main() {
if [ -n "${use_head}" ]; then if [ -n "${use_head}" ]; then
kata_version="HEAD" kata_version="HEAD"
else else
kata_version=$(get_kata_version "${branch}") kata_version=$(get_kata_version)
fi fi
fi fi
@ -201,7 +177,7 @@ main() {
[ -n "${kata_version}" ] || die "${version_file} does not contain a valid kata_version variable" [ -n "${kata_version}" ] || die "${version_file} does not contain a valid kata_version variable"
# Replacing ~ with -, as - is not a valid char for rpmbuild # Replacing ~ with -, as - is not a valid char for rpmbuild
# see https://github.com/semver/semver/issues/145 # see https://github.com/semver/semver/issues/145
[ "$(get_kata_version $branch)" = "${kata_version/\~/-}" ] && compare_result="matches" || compare_result="is different from" [ "$(get_kata_version)" = "${kata_version/\~/-}" ] && compare_result="matches" || compare_result="is different from"
echo "${kata_version} in ${versions_txt} ${compare_result} the version at branch ${branch}" echo "${kata_version} in ${versions_txt} ${compare_result} the version at branch ${branch}"
return return
fi fi

View File

@ -13,9 +13,7 @@ set -o pipefail
readonly script_name="$(basename "${BASH_SOURCE[0]}")" readonly script_name="$(basename "${BASH_SOURCE[0]}")"
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly project="kata-containers"
readonly tmp_dir=$(mktemp -d -t build-image-tmp.XXXXXXXXXX) readonly tmp_dir=$(mktemp -d -t build-image-tmp.XXXXXXXXXX)
readonly osbuilder_url=https://github.com/${project}/osbuilder.git
export GOPATH="${tmp_dir}/go" export GOPATH="${tmp_dir}/go"
export GOPATH=${GOPATH:-${HOME}/go} export GOPATH=${GOPATH:-${HOME}/go}
@ -29,16 +27,7 @@ trap exit_handler EXIT
arch_target="$(uname -m)" arch_target="$(uname -m)"
kata_version="master" source "${script_dir}/../versions.txt"
# osbuilder info
osbuider_version="${KATA_OSBUILDER_VERSION:-}"
# Agent version
agent_version="${AGENT_VERSION:-}"
if [ -z "${agent_version}" ]; then
source "${script_dir}/../versions.txt"
agent_version="${kata_agent_hash}"
fi
readonly destdir="${PWD}" readonly destdir="${PWD}"
@ -46,7 +35,6 @@ build_initrd() {
sudo -E PATH="$PATH" make initrd \ sudo -E PATH="$PATH" make initrd \
DISTRO="$initrd_distro" \ DISTRO="$initrd_distro" \
DEBUG="${DEBUG:-}" \ DEBUG="${DEBUG:-}" \
AGENT_VERSION="${agent_version}" \
OS_VERSION="${initrd_os_version}" \ OS_VERSION="${initrd_os_version}" \
ROOTFS_BUILD_DEST="${tmp_dir}/initrd-image" \ ROOTFS_BUILD_DEST="${tmp_dir}/initrd-image" \
USE_DOCKER=1 \ USE_DOCKER=1 \
@ -59,21 +47,20 @@ build_image() {
DISTRO="${img_distro}" \ DISTRO="${img_distro}" \
DEBUG="${DEBUG:-}" \ DEBUG="${DEBUG:-}" \
USE_DOCKER="1" \ USE_DOCKER="1" \
AGENT_VERSION="${agent_version}" \
IMG_OS_VERSION="${img_os_version}" \ IMG_OS_VERSION="${img_os_version}" \
ROOTFS_BUILD_DEST="${tmp_dir}/rootfs-image" ROOTFS_BUILD_DEST="${tmp_dir}/rootfs-image"
} }
create_tarball() { create_tarball() {
agent_sha=$(get_repo_hash "${GOPATH}/src/github.com/kata-containers/agent") agent_sha=$(get_repo_hash "${script_dir}")
#reduce sha size for short names #reduce sha size for short names
agent_sha=${agent_sha:0:${short_commit_length}} agent_sha=${agent_sha:0:${short_commit_length}}
tarball_name="kata-containers-${osbuider_version}-${agent_sha}-${arch_target}.tar.gz" tarball_name="kata-containers-${kata_version}-${agent_sha}-${arch_target}.tar.gz"
image_name="kata-containers-image_${img_distro}_${osbuider_version}_agent_${agent_sha}.img" image_name="kata-containers-image_${img_distro}_${kata_version}_agent_${agent_sha}.img"
initrd_name="kata-containers-initrd_${initrd_distro}_${osbuider_version}_agent_${agent_sha}.initrd" initrd_name="kata-containers-initrd_${initrd_distro}_${kata_version}_agent_${agent_sha}.initrd"
mv "${tmp_dir}/osbuilder/kata-containers.img" "${image_name}" mv "${script_dir}/../../../osbuilder/kata-containers.img" "${image_name}"
mv "${tmp_dir}/osbuilder/kata-containers-initrd.img" "${initrd_name}" mv "${script_dir}/../../../osbuilder/kata-containers-initrd.img" "${initrd_name}"
sudo tar cfzv "${tarball_name}" "${initrd_name}" "${image_name}" sudo tar cfzv "${tarball_name}" "${initrd_name}" "${image_name}"
} }
@ -106,10 +93,6 @@ main() {
;; ;;
esac esac
done done
# osbuilder info
[ -n "${osbuider_version}" ] || osbuider_version="${kata_version}"
# Agent version
[ -n "${agent_version}" ] || agent_version="${kata_version}"
install_yq install_yq
@ -126,9 +109,7 @@ main() {
initrd_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version" "${kata_version}") initrd_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version" "${kata_version}")
shift "$((OPTIND - 1))" shift "$((OPTIND - 1))"
git clone "$osbuilder_url" "${tmp_dir}/osbuilder" pushd "${script_dir}/../../../osbuilder/"
pushd "${tmp_dir}/osbuilder"
git checkout "${osbuider_version}"
build_initrd build_initrd
build_image build_image
create_tarball create_tarball

View File

@ -1,24 +0,0 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/ksm-throttler.git</param>
<param name="filename">kata-ksm-throttler</param>
<param name="versionformat">@VERSION@</param>
<param name="revision">@HASH@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

View File

@ -1,13 +0,0 @@
Source: kata-ksm-throttler
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, pkg-config, dh-systemd, systemd
Package: kata-ksm-throttler
Architecture: @deb_arch@
Description:
This project implements a Kernel Same-page Merging throttling daemon.
Its goal is to regulate KSM by dynamically modifying the KSM sysfs entries, in order to minimize memory duplication as fast as possible while keeping the KSM daemon load low.

View File

@ -1,37 +0,0 @@
#!/usr/bin/make -f
DOMAIN = github.com
ORG = kata-containers
PROJECT = ksm-throttler
IMPORTNAME = $(DOMAIN)/$(ORG)/$(PROJECT)
GO_VERSION = @GO_VERSION@
export DH_VERBOSE=1
export DH_GOPKG:=$(DOMAIN)/$(ORG)/$(PROJECT)
export DEB_BUILD_OPTIONS=nocheck
export GOPATH=/usr/src/packages/BUILD/go
export GOROOT=/tmp/local/go
export PATH:=/tmp/local/go/bin:$(PATH)
export DH_OPTIONS
%:
dh $@
override_dh_auto_build:
mkdir -p /tmp/local/
mkdir -p /usr/src/packages/BUILD/go/src/$(DOMAIN)/$(ORG)
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /tmp/local
ln -s /usr/src/packages/BUILD /usr/src/packages/BUILD/go/src/$(IMPORTNAME)
cd $(GOPATH)/src/$(IMPORTNAME); \
make \
COMMIT=@HASH@ \
TARGET=kata-ksm-throttler
override_dh_auto_install:
mkdir -p debian/$(PROJECT)
cd $(GOPATH)/src/$(IMPORTNAME); \
make install \
COMMIT=@HASH@ \
DESTDIR=$(shell pwd)/debian/kata-ksm-throttler \
TARGET=kata-ksm-throttler

View File

@ -1,16 +0,0 @@
Format: 3.0 (quilt)
Source: kata-ksm-throttler
Version: @VERSION@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, fakeroot, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make, pkg-config, dh-systemd, systemd
Debtransform-Tar: kata-ksm-throttler-@VERSION@.tar.gz
Package: kata-ksm-throttler
Architecture: @deb_arch@
Description:
This project implements a Kernel Same-page Merging throttling daemon.
Its goal is to regulate KSM by dynamically modifying the KSM sysfs entries, in order to minimize memory duplication as fast as possible while keeping the KSM daemon load low.

View File

@ -1,82 +0,0 @@
%global PREFIX /usr/
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT ksm-throttler
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%global GO_ARCH @GO_ARCH@
%if 0%{?suse_version}
%define LIBEXECDIR %{_libdir}
%else
%define LIBEXECDIR %{_libexecdir}
%endif
%undefine _missing_build_ids_terminate_build
%define debug_package %{nil}
Name: kata-ksm-throttler
Version: @VERSION@
Release: @RELEASE@
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
BuildRequires: git
BuildRequires: systemd
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-ksm-throttler``
===================
Overview
--------
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-%{GO_ARCH}.tar.gz
%setup -q
%autosetup -S git
@RPM_APPLY_PATCHES@
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s $HOME/rpmbuild/BUILD/kata-ksm-throttler-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make \
COMMIT=@HASH@ \
TARGET=kata-ksm-throttler \
LIBEXECDIR=%{LIBEXECDIR}
%install
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make install \
COMMIT=@HASH@ \
TARGET=kata-ksm-throttler \
DESTDIR=%{buildroot} \
LIBEXECDIR=%{LIBEXECDIR}
%files
%defattr(-,root,root,-)
%{LIBEXECDIR}/kata-ksm-throttler
%{LIBEXECDIR}/kata-ksm-throttler/kata-ksm-throttler
%{LIBEXECDIR}/kata-ksm-throttler/trigger
%{LIBEXECDIR}/kata-ksm-throttler/trigger/virtcontainers
%{LIBEXECDIR}/kata-ksm-throttler/trigger/virtcontainers/vc
/usr/lib/systemd/system/kata-ksm-throttler.service
/usr/lib/systemd/system/kata-vc-throttler.service

View File

@ -1,56 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# 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.
[ -z "${DEBUG}" ] || set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $0)
PKG_NAME="kata-ksm-throttler"
VERSION="${kata_ksm_throttler_version}"
HASH="${kata_ksm_throttler_hash}"
GENERATED_FILES=(_service kata-ksm-throttler.spec kata-ksm-throttler.dsc debian.control debian.rules)
STATIC_FILES=(debian.compat)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/ksm-throttler}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
set_versions "$kata_ksm_throttler_hash"
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=${short_hashtag}"
"RELEASE=$RELEASE"
"VERSION=$VERSION"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@ -1,24 +0,0 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/proxy.git</param>
<param name="filename">kata-proxy</param>
<param name="versionformat">@VERSION@</param>
<param name="revision">@HASH@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

View File

@ -1,13 +0,0 @@
Source: kata-proxy
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: dh-make, git, ca-certificates, execstack, devscripts, debhelper, build-essential, dh-autoreconf, make
Package: kata-proxy
Architecture: @deb_arch@
Description:
kata-proxy works alongside the Kata Containers runtime and shim to provide a VM-based OCI runtime solution.
kata-proxy is a daemon offering access to the hyperstart VM agent to both the runtime and shim processes.

View File

@ -1,23 +0,0 @@
#!/usr/bin/make -f
export DH_OPTIONS
export DH_GOPKG:=github.com/kata-containers/proxy
export DEB_BUILD_OPTIONS=nocheck
export PATH:=/usr/src/packages/BUILD/local/go/bin:$(PATH)
export GOROOT:=/usr/src/packages/BUILD/local/go
export GOPATH=/usr/src/packages/BUILD/go
GO_VERSION=@GO_VERSION@
%:
dh $@
override_dh_auto_build:
mkdir -p /usr/src/packages/BUILD/local/
mkdir -p /usr/src/packages/BUILD/go/src/github.com/kata-containers/
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /usr/src/packages/BUILD/local/
ln -s /usr/src/packages/BUILD/ /usr/src/packages/BUILD/go/src/github.com/kata-containers/proxy
cd $(GOPATH)/src/github.com/kata-containers/proxy && make COMMIT=@HASH@
override_dh_auto_install:
mkdir debian/kata-proxy
make install DESTDIR=$(shell pwd)/debian/kata-proxy COMMIT=@HASH@

View File

@ -1,16 +0,0 @@
format: 3.0 (quilt)
Source: kata-proxy
Version: @VERSION@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Build-Depends: dh-make, git, ca-certificates, execstack, fakeroot, devscripts, debhelper, build-essential, dh-autoreconf, make
Homepage: https://katacontainers.io
Debtransform-Tar: kata-proxy-@VERSION@.tar.gz
Package: kata-proxy
Architecture: @deb_arch@
Description:
kata-proxy works alongside the Kata Containers runtime and shim to provide a VM-based OCI runtime solution.
kata-proxy is a daemon offering access to the hyperstart VM agent to both the runtime and shim processes.

View File

@ -1,80 +0,0 @@
%global PREFIX /usr/
%global BINDIR %{PREFIX}/bin
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT proxy
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%define LIBEXECDIR /usr/libexec
%undefine _missing_build_ids_terminate_build
Name: kata-proxy
Version: @VERSION@
Release: @RELEASE@
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig(systemd)
BuildRequires: git
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
Requires: kata-proxy-bin
#!BuildIgnore: post-build-checks
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-proxy``
===================
Overview
--------
%global debug_package %{nil}
%define _unpackaged_files_terminate_build 0
%package bin
Summary: bin components for the kata-proxy package.
Group: Binaries
%description bin
bin components for the kata-proxy package.
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-@GO_ARCH@.tar.gz
%setup -q
# Patches
@RPM_APPLY_PATCHES@
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s %{_builddir}/%{name}-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make COMMIT=@HASH@
%clean
echo "Clean build root"
rm -rf %{buildroot}
%install
make install DESTDIR=%{buildroot} COMMIT=@HASH@
%files
%defattr(-,root,root,-)
%files bin
%defattr(-,root,root,-)
%{LIBEXECDIR}/kata-containers
%{LIBEXECDIR}/kata-containers/kata-proxy

View File

@ -1,52 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Automation script to create specs to build kata-proxy
[ -z "${DEBUG}" ] || set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname "$0")
PKG_NAME="kata-proxy"
VERSION=$kata_proxy_version
GENERATED_FILES=(kata-proxy.spec kata-proxy.dsc debian.control debian.rules _service)
STATIC_FILES=(debian.compat)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/proxy}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
set_versions $kata_proxy_hash
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=$short_hashtag"
"RELEASE=$RELEASE"
"VERSION=$VERSION"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@ -3,7 +3,7 @@
<!--- OBS plugin tar_scm (Source control manager) --> <!--- OBS plugin tar_scm (Source control manager) -->
<service name="tar_scm"> <service name="tar_scm">
<param name="scm">git</param> <param name="scm">git</param>
<param name="url">https://github.com/kata-containers/runtime.git</param> <param name="url">https://github.com/kata-containers/kata-containers.git</param>
<param name="filename">kata-runtime</param> <param name="filename">kata-runtime</param>
<!--- versionformat defines the name of the tarball. --> <!--- versionformat defines the name of the tarball. -->
<param name="versionformat">@VERSION@</param> <param name="versionformat">@VERSION@</param>

View File

@ -11,9 +11,6 @@ Package: kata-runtime
Architecture: @deb_arch@ Architecture: @deb_arch@
Depends: kata-containers-image (= @kata_osbuilder_version_release@), Depends: kata-containers-image (= @kata_osbuilder_version_release@),
kata-linux-container (= @linux_container_version_release@), kata-linux-container (= @linux_container_version_release@),
kata-proxy (= @kata_proxy_version_release@),
kata-shim (= @kata_shim_version_release@),
kata-ksm-throttler(= @ksm_throttler_version_release@),
qemu-vanilla(= @qemu_vanilla_version_release@) qemu-vanilla(= @qemu_vanilla_version_release@)
Description: Description:
An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x

View File

@ -16,9 +16,6 @@ Package: kata-runtime
Architecture: @deb_arch@ Architecture: @deb_arch@
Depends: kata-containers-image (= @kata_osbuilder_version_release@), Depends: kata-containers-image (= @kata_osbuilder_version_release@),
kata-linux-container (= @linux_container_version_release@), kata-linux-container (= @linux_container_version_release@),
kata-proxy (= @kata_proxy_version_release@),
kata-shim (= @kata_shim_version_release@),
kata-ksm-throttler(= @ksm_throttler_version_release@),
qemu-vanilla(= @qemu_vanilla_version_release@) qemu-vanilla(= @qemu_vanilla_version_release@)
Description: Description:
An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x

View File

@ -26,9 +26,6 @@ BuildRequires: git
Requires: kata-containers-image = @kata_osbuilder_version@ Requires: kata-containers-image = @kata_osbuilder_version@
Requires: kata-linux-container = @linux_container_version@ Requires: kata-linux-container = @linux_container_version@
Requires: kata-proxy = @kata_proxy_version@
Requires: kata-shim = @kata_shim_version@
Requires: kata-ksm-throttler = @ksm_throttler_version@
Requires: qemu-vanilla = @qemu_vanilla_version@ Requires: qemu-vanilla = @qemu_vanilla_version@
# Patches # Patches

View File

@ -90,37 +90,18 @@ cli "$@"
declare -a pkgVersions declare -a pkgVersions
# Package depedencies # Package depedencies
info "Requires:" info "Requires:"
pkgVersions=($(pkg_required_ver "kata_proxy"))
declare -A PROXY_REQUIRED_VERSION
PROXY_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
PROXY_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
info "proxy ${PROXY_REQUIRED_VERSION[@]}"
declare -A SHIM_REQUIRED_VERSION
pkgVersions=($(pkg_required_ver "kata_shim"))
SHIM_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
SHIM_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
info "shim ${SHIM_REQUIRED_VERSION[@]}"
declare -A KERNEL_REQUIRED_VERSION declare -A KERNEL_REQUIRED_VERSION
pkgVersions=($(pkg_required_ver "kernel")) pkgVersions=($(pkg_required_ver "kernel"))
KERNEL_REQUIRED_VERSION["deb"]=${pkgVersions[0]} KERNEL_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
KERNEL_REQUIRED_VERSION["rpm"]=${pkgVersions[1]} KERNEL_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
info "kata-linux-container ${KERNEL_REQUIRED_VERSION[@]}" info "kata-linux-container ${KERNEL_REQUIRED_VERSION[@]}"
declare -A KSM_THROTTLER_REQUIRED_VERSION
pkgVersions=($(pkg_required_ver "kata_ksm_throttler"))
KSM_THROTTLER_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
KSM_THROTTLER_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
info "ksm-throttler ${KSM_THROTTLER_REQUIRED_VERSION[@]}"
declare -A KATA_IMAGE_REQUIRED_VERSION declare -A KATA_IMAGE_REQUIRED_VERSION
pkgVersions=($(pkg_required_ver "kata_osbuilder")) pkgVersions=($(pkg_required_ver "kata_osbuilder"))
KATA_IMAGE_REQUIRED_VERSION["deb"]=${pkgVersions[0]} KATA_IMAGE_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
KATA_IMAGE_REQUIRED_VERSION["rpm"]=${pkgVersions[1]} KATA_IMAGE_REQUIRED_VERSION["rpm"]=${pkgVersions[1]}
info "image ${KATA_IMAGE_REQUIRED_VERSION[@]}" info "image ${KATA_IMAGE_REQUIRED_VERSION[@]}"
declare -A KATA_QEMU_VANILLA_REQUIRED_VERSION declare -A KATA_QEMU_VANILLA_REQUIRED_VERSION
pkgVersions=($(pkg_required_ver "qemu_vanilla")) pkgVersions=($(pkg_required_ver "qemu_vanilla"))
KATA_QEMU_VANILLA_REQUIRED_VERSION["deb"]=${pkgVersions[0]} KATA_QEMU_VANILLA_REQUIRED_VERSION["deb"]=${pkgVersions[0]}
@ -140,14 +121,6 @@ replace_list+=(
"HASH=$short_hashtag" "HASH=$short_hashtag"
"RELEASE=$RELEASE" "RELEASE=$RELEASE"
"VERSION=$VERSION" "VERSION=$VERSION"
"kata_osbuilder_version=${KATA_IMAGE_REQUIRED_VERSION["rpm"]}"
"kata_osbuilder_version_release=${KATA_IMAGE_REQUIRED_VERSION["deb"]}"
"kata_proxy_version=${PROXY_REQUIRED_VERSION["rpm"]}"
"kata_proxy_version_release=${PROXY_REQUIRED_VERSION["deb"]}"
"kata_shim_version=${SHIM_REQUIRED_VERSION["rpm"]}"
"kata_shim_version_release=${SHIM_REQUIRED_VERSION["deb"]}"
"ksm_throttler_version=${KSM_THROTTLER_REQUIRED_VERSION["rpm"]}"
"ksm_throttler_version_release=${KSM_THROTTLER_REQUIRED_VERSION["deb"]}"
"linux_container_version=${KERNEL_REQUIRED_VERSION["rpm"]}" "linux_container_version=${KERNEL_REQUIRED_VERSION["rpm"]}"
"linux_container_version_release=${KERNEL_REQUIRED_VERSION["deb"]}" "linux_container_version_release=${KERNEL_REQUIRED_VERSION["deb"]}"
"qemu_vanilla_version=${KATA_QEMU_VANILLA_REQUIRED_VERSION["rpm"]}" "qemu_vanilla_version=${KATA_QEMU_VANILLA_REQUIRED_VERSION["rpm"]}"

View File

@ -15,8 +15,5 @@ OBS_PKGS_PROJECTS+=(
qemu-vanilla qemu-vanilla
linux-container linux-container
kata-containers-image kata-containers-image
proxy
shim
ksm-throttler
runtime runtime
) )

View File

@ -1,24 +0,0 @@
<!--- XML Structure defined here: https://en.opensuse.org/openSUSE:Build_Service_Concept_SourceService -->
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://github.com/kata-containers/shim.git</param>
<param name="filename">kata-shim</param>
<param name="versionformat">@VERSION@</param>
<param name="revision">@HASH@</param>
</service>
<service name="recompress">
<param name="file">*.tar*</param>
<param name="compression">gz</param>
</service>
<service name="download_url">
<param name="protocol">https</param>
<param name="host">storage.googleapis.com</param>
<param name="path">golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
</service>
<service name="verify_file">
<param name="file">_service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz</param>
<param name="verifier">sha256</param>
<param name="checksum">@GO_CHECKSUM@</param>
</service>
</services>

View File

@ -1,14 +0,0 @@
Source: kata-shim
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Homepage: https://katacontainers.io
Build-Depends: debhelper (>= 9), git, ca-certificates, execstack, devscripts, dh-make
Package: kata-shim
Architecture: @deb_arch@
Description:
kata-shim is a process spawned by the Intel VT-x secured Kata Containers runtime per container workload.
The runtime provides the pid of the kata-shim process to containerd-shim on OCI create command.

View File

@ -1,21 +0,0 @@
#!/usr/bin/make -f
export DEB_BUILD_OPTIONS=nocheck
export PATH:=/usr/src/packages/BUILD/local/go/bin:$(PATH)
export GOROOT:=/usr/src/packages/BUILD/local/go
export GOPATH=/usr/src/packages/BUILD/go
GO_VERSION=@GO_VERSION@
%:
dh $@
override_dh_auto_build:
mkdir -p /usr/src/packages/BUILD/local/
mkdir -p /usr/src/packages/BUILD/go/src/github.com/kata-containers/
tar xzf /usr/src/packages/SOURCES/go$(GO_VERSION).linux-@GO_ARCH@.tar.gz -C /usr/src/packages/BUILD/local/
ln -s /usr/src/packages/BUILD/ /usr/src/packages/BUILD/go/src/github.com/kata-containers/shim
cd $(GOPATH)/src/github.com/kata-containers/shim && make COMMIT=@HASH@
override_dh_auto_install:
mkdir -p debian/kata-shim
make install LIBEXECDIR=$(shell pwd)/debian/kata-shim/usr/libexec COMMIT=@HASH@

View File

@ -1,17 +0,0 @@
Format: 3.0 (quilt)
Source: kata-shim
Version: @VERSION@-@RELEASE@
Section: devel
Priority: optional
Maintainer: Kata containers team <https://github.com/kata-containers/>
Standards-Version: 3.9.6
Build-Depends: debhelper (>= 9), git, ca-certificates, execstack, fakeroot, devscripts, dh-make
Homepage: https://katacontainers.io
Debtransform-Tar: kata-shim-@VERSION@.tar.gz
Package: kata-shim
Architecture: @deb_arch@
Description:
kata-shim is a process spawned by the Intel VT-x secured Kata Containers runtime per container workload.
The runtime provides the pid of the kata-shim process to containerd-shim on OCI create command.

View File

@ -1,78 +0,0 @@
%global DOMAIN github.com
%global ORG kata-containers
%global PROJECT shim
%global IMPORTNAME %{DOMAIN}/%{ORG}/%{PROJECT}
%global GO_VERSION @GO_VERSION@
%define LIBEXECDIR /usr/libexec
%undefine _missing_build_ids_terminate_build
Name: kata-shim
Version: @VERSION@
Release: @RELEASE@
Summary : No detailed summary available
Group : Development/Tools
License : Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: git
Requires: kata-shim-bin
%global debug_package %{nil}
# Patches
@RPM_PATCH_LIST@
%description
.. contents::
.. sectnum::
``kata-shim``
===================
Overview
--------
%package bin
Summary: bin components for the kata-shim package.
Group: Binaries
%description bin
bin components for the kata-shim package.
%prep
mkdir local
tar -C local -xzf ../SOURCES/go%{GO_VERSION}.linux-@GO_ARCH@.tar.gz
%setup -q
# Patches
@RPM_APPLY_PATCHES@
%build
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
mkdir -p $HOME/rpmbuild/BUILD/go/src/%{DOMAIN}/%{ORG}
ln -s %{_builddir}/%{name}-%{version} $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
cd $HOME/rpmbuild/BUILD/go/src/%{IMPORTNAME}
make COMMIT=@HASH@
%check
export http_proxy=http://127.0.0.1:9/
export https_proxy=http://127.0.0.1:9/
export no_proxy=localhost
%install
export GOROOT=$HOME/rpmbuild/BUILD/local/go
export PATH=$PATH:$HOME/rpmbuild/BUILD/local/go/bin
export GOPATH=$HOME/rpmbuild/BUILD/go/
make install LIBEXECDIR=%{buildroot}%{LIBEXECDIR} COMMIT=@HASH@
%files
%defattr(-,root,root,-)
%files bin
%defattr(-,root,root,-)
%dir %{LIBEXECDIR}
%dir %{LIBEXECDIR}/kata-containers
%{LIBEXECDIR}/kata-containers/kata-shim

View File

@ -1,52 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Automation script to create specs to build kata-shim
[ -z "${DEBUG}" ] || set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
source ../versions.txt
source ../scripts/pkglib.sh
SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname "$0")
PKG_NAME="kata-shim"
VERSION=$kata_shim_version
GENERATED_FILES=(kata-shim.spec kata-shim.dsc _service debian.control debian.rules)
STATIC_FILES=(debian.compat)
# Parse arguments
cli "$@"
[ "$VERBOSE" == "true" ] && set -x
PROJECT_REPO=${PROJECT_REPO:-home:${OBS_PROJECT}:${OBS_SUBPROJECT}/shim}
RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
((RELEASE++))
set_versions $kata_shim_hash
replace_list=(
"GO_CHECKSUM=$go_checksum"
"GO_VERSION=$go_version"
"GO_ARCH=$GO_ARCH"
"HASH=$short_hashtag"
"RELEASE=$RELEASE"
"VERSION=$VERSION"
)
verify
echo "Verify succeed."
get_git_info
changelog_update $VERSION
generate_files "$SCRIPT_DIR" "${replace_list[@]}"
build_pkg "${PROJECT_REPO}"

View File

@ -31,37 +31,24 @@ $ ./update-repository-version.sh -h
### Update Kata projects to a new version ### Update Kata projects to a new version
Kata Containers is divided into multiple projects. With each release, all To update project version for Kata Containers, use the following:
project versions are updated to keep the version consistent.
To update all versions for all projects, use the following:
```bash ```bash
$ make bump-kata-version NEW_VERSION=<new-version> $ make bump-kata-version NEW_VERSION=<new-version>
``` ```
The makefile target `bump-kata-version` creates a GitHub pull request in the The makefile target `bump-kata-version` creates a GitHub pull request in the
Kata repositories. These pull requests are tested by the Kata CI to ensure the kata-containers repository. The pull request is tested by the Kata CI to ensure the
entire project is working prior to the release. Next, the PR is approved and entire project is working prior to the release. Next, the PR is approved and
merged by Kata Containers members. merged by Kata Containers members.
### `tag_repos.sh` ### `tag_repos.sh`
After all the Kata repositories are updated with a new version, they need to be After Kata Containers repository is updated with a new version, it needs to be
tagged. tagged.
The `tag_repos.sh` script is used to create tags for the Kata Containers The `tag_repos.sh` script is used to create tags for the Kata Containers repository.
repositories. This script ensures that all the repositories are in the same
version (by checking the `VERSION` file).
The script creates an **annotated tag** for the new release version for the The script creates an **annotated tag** for the new release version for the
following repositories: following repositories:
- agent - kata-containers
- proxy
- runtime
- shim
- throttler
The script also tags the tests and osbuilder repositories to make it clear which
versions of these supporting repositories are used for the release.

View File

@ -13,7 +13,7 @@ readonly script_name="$(basename "${BASH_SOURCE[0]}")"
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly project="kata-containers" readonly project="kata-containers"
readonly prefix="/opt/kata" readonly prefix="/opt/kata"
readonly project_to_attach="github.com/${project}/runtime" readonly project_to_attach="github.com/${project}/${project}"
readonly tmp_dir=$(mktemp -d -t static-build-tmp.XXXXXXXXXX) readonly tmp_dir=$(mktemp -d -t static-build-tmp.XXXXXXXXXX)
readonly GOPATH="${tmp_dir}/go" readonly GOPATH="${tmp_dir}/go"
# flag to decide if push tarball to github # flag to decide if push tarball to github
@ -32,12 +32,6 @@ exit_handler() {
} }
trap exit_handler EXIT trap exit_handler EXIT
projects=(
proxy
runtime
shim
)
die() { die() {
msg="$*" msg="$*"
echo "ERROR: ${msg}" >&2 echo "ERROR: ${msg}" >&2
@ -201,22 +195,18 @@ install_docker_config_script() {
#Install all components that are not assets #Install all components that are not assets
install_kata_components() { install_kata_components() {
kata_version=${1:-$kata_version} kata_version=${1:-$kata_version}
for p in "${projects[@]}"; do pushd "${script_dir}/../../../src/runtime"
echo "Download ${p}" echo "Checkout to version ${kata_version}"
go get "github.com/${project}/$p" || true git checkout "${kata_version}"
pushd "${GOPATH}/src/github.com/${project}/$p" >>/dev/null echo "Build"
echo "Checkout to version ${kata_version}" make \
git checkout "${kata_version}" PREFIX="${prefix}" \
echo "Build" QEMUCMD="qemu-system-x86_64"
make \ echo "Install"
PREFIX="${prefix}" \ make PREFIX="${prefix}" \
QEMUCMD="qemu-system-x86_64" DESTDIR="${destdir}" \
echo "Install" install
make PREFIX="${prefix}" \ popd
DESTDIR="${destdir}" \
install
popd >>/dev/null
done
sed -i -e '/^initrd =/d' "${destdir}/${prefix}/share/defaults/${project}/configuration-qemu.toml" sed -i -e '/^initrd =/d' "${destdir}/${prefix}/share/defaults/${project}/configuration-qemu.toml"
sed -i -e '/^initrd =/d' "${destdir}/${prefix}/share/defaults/${project}/configuration-fc.toml" sed -i -e '/^initrd =/d' "${destdir}/${prefix}/share/defaults/${project}/configuration-fc.toml"
pushd "${destdir}/${prefix}/share/defaults/${project}" pushd "${destdir}/${prefix}/share/defaults/${project}"
@ -300,7 +290,7 @@ main() {
tar cfJ "${tarball_name}" "./opt" tar cfJ "${tarball_name}" "./opt"
popd >>/dev/null popd >>/dev/null
if [ "${push}" == "true" ]; then if [ "${push}" == "true" ]; then
hub -C "${GOPATH}/src/github.com/${project}/runtime" release edit -a "${tarball_name}" "${kata_version}" hub -C "${GOPATH}/src/github.com/${project}/${project}" release edit -a "${tarball_name}" "${kata_version}"
else else
echo "Wont push the tarball to github use -p option to do it." echo "Wont push the tarball to github use -p option to do it."
fi fi

View File

@ -68,15 +68,6 @@ info() {
} }
repos=( repos=(
"agent"
"documentation"
"ksm-throttler"
"osbuilder"
"packaging"
"proxy"
"runtime"
"shim"
"tests"
"kata-containers" "kata-containers"
) )
@ -208,7 +199,7 @@ main () {
subcmd=${1:-""} subcmd=${1:-""}
shift || true shift || true
kata_version=$(curl -Ls "${URL_RAW_FILE}/runtime/${branch}/VERSION" | grep -v -P "^#") kata_version=$(curl -Ls "${URL_RAW_FILE}/kata-containers/${branch}/VERSION" | grep -v -P "^#")
[ -z "${subcmd}" ] && usage && exit 0 [ -z "${subcmd}" ] && usage && exit 0

View File

@ -16,10 +16,10 @@ echo "Check tag_repos.sh -h option"
./release/tag_repos.sh -h | grep Usage ./release/tag_repos.sh -h | grep Usage
echo "Check tag_repos.sh status" echo "Check tag_repos.sh status"
./release/tag_repos.sh status | grep runtime ./release/tag_repos.sh status | grep kata-containers
echo "Check tag_repos.sh pre-release" echo "Check tag_repos.sh pre-release"
./release/tag_repos.sh pre-release $(curl -sL https://raw.githubusercontent.com/kata-containers/runtime/master/VERSION) | grep "Not checking runtime" ./release/tag_repos.sh pre-release $(curl -sL https://raw.githubusercontent.com/kata-containers/kata-containers/2.0-dev/VERSION) | grep "Not checking runtime"
echo "Check tag_repos.sh pre-release with invalid information" echo "Check tag_repos.sh pre-release with invalid information"
./release/tag_repos.sh pre-release 1000000 | grep "ERROR" || true ./release/tag_repos.sh pre-release 1000000 | grep "ERROR" || true

View File

@ -164,16 +164,7 @@ EOT
} }
repos=( repos=(
"agent"
"documentation"
"kata-containers" "kata-containers"
"ksm-throttler"
"osbuilder"
"packaging"
"proxy"
"runtime"
"shim"
"tests"
) )
main(){ main(){

View File

@ -9,6 +9,8 @@ export GOPATH=${GOPATH:-${HOME}/go}
export tests_repo="${tests_repo:-github.com/kata-containers/tests}" export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
export tests_repo_dir="$GOPATH/src/$tests_repo" export tests_repo_dir="$GOPATH/src/$tests_repo"
this_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
hub_bin="hub-bin" hub_bin="hub-bin"
clone_tests_repo() { clone_tests_repo() {
@ -32,16 +34,14 @@ get_from_kata_deps() {
local dependency="$1" local dependency="$1"
BRANCH=${branch:-master} BRANCH=${branch:-master}
local branch="${2:-${BRANCH}}" local branch="${2:-${BRANCH}}"
local runtime_repo="github.com/kata-containers/kata-containers"
GOPATH=${GOPATH:-${HOME}/go} GOPATH=${GOPATH:-${HOME}/go}
local runtime_repo_dir="${GOPATH}/src/${runtime_repo}"
# For our CI, we will query the local versions.yaml file both for kernel and # For our CI, we will query the local versions.yaml file both for kernel and
# all other subsystems. eg: a new version of NEMU would be good to test # all other subsystems. eg: a new version of NEMU would be good to test
# through CI. For the kernel, .ci/install_kata_kernel.sh file in tests # through CI. For the kernel, .ci/install_kata_kernel.sh file in tests
# repository will pass the kernel version as an override to this function to # repository will pass the kernel version as an override to this function to
# allow testing of kernels before they land in tree. # allow testing of kernels before they land in tree.
if [ "${CI:-}" = "true" ] && [ -d "${runtime_repo_dir}" ]; then if [ "${CI:-}" = "true" ]; then
versions_file="${runtime_repo_dir}/versions.yaml" versions_file="${this_script_dir}/../../../versions.yaml"
else else
versions_file="versions-${branch}.yaml" versions_file="versions-${branch}.yaml"
fi fi
@ -50,10 +50,7 @@ get_from_kata_deps() {
install_yq >&2 install_yq >&2
if [ ! -e "${versions_file}" ]; then if [ ! -e "${versions_file}" ]; then
yaml_url="https://raw.githubusercontent.com/kata-containers/runtime/${branch}/versions.yaml" cp "${this_script_dir}/../../../versions.yaml" ${versions_file}
echo "versions file (${versions_file}) does not exist" >&2
echo "Download from ${yaml_url}" >&2
curl --silent -o "${versions_file}" "$yaml_url"
fi fi
result=$("${GOPATH}/bin/yq" read -X "$versions_file" "$dependency") result=$("${GOPATH}/bin/yq" read -X "$versions_file" "$dependency")
[ "$result" = "null" ] && result="" [ "$result" = "null" ] && result=""

View File

@ -114,7 +114,7 @@ assets:
description: | description: |
Root filesystem disk image used to boot the guest virtual Root filesystem disk image used to boot the guest virtual
machine. machine.
url: "https://github.com/kata-containers/osbuilder" url: "https://github.com/kata-containers/kata-containers/tools/osbuilder"
architecture: architecture:
aarch64: aarch64:
name: "ubuntu" name: "ubuntu"
@ -135,7 +135,7 @@ assets:
description: | description: |
Root filesystem initrd used to boot the guest virtual Root filesystem initrd used to boot the guest virtual
machine. machine.
url: "https://github.com/kata-containers/osbuilder" url: "https://github.com/kata-containers/kata-containers/tools/osbuilder"
architecture: architecture:
aarch64: aarch64:
name: &default-initrd-name "alpine" name: &default-initrd-name "alpine"
@ -162,16 +162,6 @@ assets:
url: "https://gitlab.com/virtio-fs/linux.git" url: "https://gitlab.com/virtio-fs/linux.git"
tag: "kata-v5.6-april-09-2020" tag: "kata-v5.6-april-09-2020"
components:
description: "Core system functionality"
agent:
description: |
Container management service running in the guest virtual machines
root context.
url: "https://github.com/kata-containers/agent"
commit: "6f6e9ecd8aded0783c31968b304a9d6589114363"
externals: externals:
description: "Third-party projects used by the system" description: "Third-party projects used by the system"