diff --git a/.github/workflows/generate-local-artifact-tarball.sh b/.github/workflows/generate-local-artifact-tarball.sh new file mode 100755 index 0000000000..d14d30fbfc --- /dev/null +++ b/.github/workflows/generate-local-artifact-tarball.sh @@ -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 $@ diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9d0bb922bb..718e4e1b11 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -2,7 +2,7 @@ name: Publish release tarball on: push: tags: - - '*' + - '1.*' jobs: get-artifact-list: @@ -10,12 +10,11 @@ jobs: steps: - name: get the list run: | - git clone https://github.com/kata-containers/packaging - pushd packaging + pushd $GITHUB_WORKSPACE tag=$(echo $GITHUB_REF | cut -d/ -f3-) git checkout $tag popd - ./packaging/artifact-list.sh > artifact-list.txt + $GITHUB_WORKSPACE/tools/packaging/artifact-list.sh > artifact-list.txt - name: save-artifact-list uses: actions/upload-artifact@master with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000000..6a8ef6284d --- /dev/null +++ b/.github/workflows/release.yaml @@ -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}" diff --git a/.gitignore b/.gitignore index e9fad65b1f..4c5f3a1c34 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ **/*.orig **/*.rej **/target +**/.vscode diff --git a/ci/install_musl.sh b/ci/install_musl.sh new file mode 100755 index 0000000000..30d2d642b5 --- /dev/null +++ b/ci/install_musl.sh @@ -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 diff --git a/tools/osbuilder/scripts/install-yq.sh b/ci/install_yq.sh old mode 100644 new mode 100755 similarity index 97% rename from tools/osbuilder/scripts/install-yq.sh rename to ci/install_yq.sh index 8e1b039abe..2bc3cf21af --- a/tools/osbuilder/scripts/install-yq.sh +++ b/ci/install_yq.sh @@ -63,7 +63,6 @@ function install_yq() { curl -o "${yq_path}" -LSsf "${yq_url}" [ $? -ne 0 ] && die "Download ${yq_url} failed" chmod +x "${yq_path}" - echo "Installed $(${yq_path} --version)" if ! command -v "${yq_path}" >/dev/null; then die "Cannot not get ${yq_path} executable" @@ -71,4 +70,3 @@ function install_yq() { } install_yq - diff --git a/src/runtime/golang.mk b/src/runtime/golang.mk index d69bc2ceb9..e342a53113 100644 --- a/src/runtime/golang.mk +++ b/src/runtime/golang.mk @@ -22,7 +22,7 @@ ifeq (,$(not_check_version)) have_yq=$(shell if [ -x "$(GOPATH)/bin/yq" ]; then echo "true"; else echo ""; fi) ifeq (,$(have_yq)) $(info INFO: yq was not found, installing it) - install_yq=$(shell .ci/install-yq.sh) + install_yq=$(shell ../../ci/install_yq.sh) endif ifneq (,$(install_yq)) $(error "ERROR: install yq failed") diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile b/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile index 5d27661958..2ab3ea54db 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile @@ -6,7 +6,7 @@ all: | update-yaml generate-client-code 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" YQ := $(shell command -v yq 2> /dev/null) @@ -22,7 +22,7 @@ generate-client-code: clean-generated-code update-yaml: ifndef YQ - $(MK_DIR)/../../../.ci/install-yq.sh + $(MK_DIR)/../../../../../ci//install_yq.sh endif 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 diff --git a/tools/osbuilder/Makefile b/tools/osbuilder/Makefile index 15e57b9b77..316dcecf57 100644 --- a/tools/osbuilder/Makefile +++ b/tools/osbuilder/Makefile @@ -13,6 +13,7 @@ DISTRO := centos BUILD_METHOD := distro BUILD_METHOD_LIST := distro dracut AGENT_INIT ?= no +USE_DOCKER ?= true ROOTFS_BUILD_DEST := $(shell pwd) IMAGES_BUILD_DEST := $(shell pwd) ROOTFS_MARKER_SUFFIX := _rootfs.done diff --git a/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in b/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in index dba67a9fe4..04b9e091c0 100644 --- a/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in +++ b/tools/osbuilder/rootfs-builder/alpine/Dockerfile.in @@ -3,39 +3,9 @@ # # 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 \ - apk-tools-static \ - autoconf \ - automake \ - 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++ + bash \ + coreutils \ + binutils diff --git a/tools/osbuilder/rootfs-builder/alpine/config.sh b/tools/osbuilder/rootfs-builder/alpine/config.sh index 65baeee0ac..d07f70b03a 100644 --- a/tools/osbuilder/rootfs-builder/alpine/config.sh +++ b/tools/osbuilder/rootfs-builder/alpine/config.sh @@ -13,9 +13,7 @@ BASE_PACKAGES="alpine-base" # See a list of mirrors at http://nl.alpinelinux.org/alpine/MIRRORS.txt MIRROR=http://dl-5.alpinelinux.org/alpine -# Mandatory Packages that must be installed -# - iptables: Need by Kata agent -PACKAGES="iptables" +PACKAGES="" # Init process must be one of {systemd,kata-agent} INIT_PROCESS=kata-agent diff --git a/tools/osbuilder/rootfs-builder/alpine/rootfs_lib.sh b/tools/osbuilder/rootfs-builder/alpine/rootfs_lib.sh index dd4c513aa4..d41cbd5766 100644 --- a/tools/osbuilder/rootfs-builder/alpine/rootfs_lib.sh +++ b/tools/osbuilder/rootfs-builder/alpine/rootfs_lib.sh @@ -9,8 +9,6 @@ # # - Optional environment variables # -# EXTRA_PKGS: Variable to add extra PKGS provided by the user -# # BIN_AGENT: Name of the Kata-Agent binary # # Any other configuration variable for a specific distro must be added @@ -24,21 +22,13 @@ build_rootfs() { # Mandatory 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 check_root mkdir -p "${ROOTFS_DIR}" - /sbin/apk.static \ - -X ${MIRROR}/${OS_VERSION}/main \ - -U \ - --allow-untrusted \ - --root ${ROOTFS_DIR}\ - --initdb add ${BASE_PACKAGES} ${EXTRA_PKGS} ${PACKAGES} + rm -rf ${ROOTFS_DIR}/var/tmp + cp -a -r -f /bin /etc /lib /sbin /usr /var ${ROOTFS_DIR} + mkdir -p ${ROOTFS_DIR}{/root,/proc,/dev,/home,/media,/mnt,/opt,/run,/srv,/sys,/tmp} - mkdir -p ${ROOTFS_DIR}{/root,/etc/apk,/proc} echo "${MIRROR}/${OS_VERSION}/main" > ${ROOTFS_DIR}/etc/apk/repositories } diff --git a/tools/osbuilder/rootfs-builder/rootfs.sh b/tools/osbuilder/rootfs-builder/rootfs.sh index 483a7e83c3..9800d9d8ce 100755 --- a/tools/osbuilder/rootfs-builder/rootfs.sh +++ b/tools/osbuilder/rootfs-builder/rootfs.sh @@ -15,7 +15,7 @@ script_dir="$(dirname $(readlink -f $0))" AGENT_VERSION=${AGENT_VERSION:-} 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=${RUST_AGENT:-no} +RUST_AGENT=${RUST_AGENT:-yes} RUST_VERSION="null" CMAKE_VERSION=${CMAKE_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 build_rootfs_distro() { + repo_dir="${script_dir}/../../../" [ -n "${distro}" ] || usage 1 distro_config_dir="${script_dir}/${distro}" @@ -346,21 +347,8 @@ build_rootfs_distro() if [ -z "${USE_DOCKER}" ] && [ -z "${USE_PODMAN}" ]; then #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") - - 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 + info "build directly" + build_rootfs ${ROOTFS_DIR} else if [ -n "${USE_DOCKER}" ]; then container_engine="docker" @@ -394,6 +382,7 @@ build_rootfs_distro() else docker_run_args+=" --env 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 docker_run_args+=" $(docker_extra_args $distro)" @@ -427,19 +416,16 @@ build_rootfs_distro() --env INSIDE_CONTAINER=1 \ --env SECCOMP="${SECCOMP}" \ --env DEBUG="${DEBUG}" \ + --env STAGE_PREPARE_ROOTFS=1 \ --env HOME="/root" \ - -v "${script_dir}":"/osbuilder" \ + -v "${repo_dir}":"/kata-containers" \ -v "${ROOTFS_DIR}":"/rootfs" \ -v "${script_dir}/../scripts":"/scripts" \ -v "${kernel_mod_dir}":"${kernel_mod_dir}" \ $docker_run_args \ ${image_name} \ - bash /osbuilder/rootfs.sh "${distro}" - - exit $? + bash /kata-containers/tools/osbuilder/rootfs-builder/rootfs.sh "${distro}" fi - - build_rootfs ${ROOTFS_DIR} } # Used to create a minimal directory tree where the agent can be instaleld. @@ -553,23 +539,16 @@ EOT AGENT_DEST="${AGENT_DIR}/${AGENT_BIN}" if [ -z "${AGENT_SOURCE_BIN}" ] ; then - if [ "$RUST_AGENT" != "yes" ]; then - agent_pkg="${GO_AGENT_PKG}" - agent_dir="${GOPATH_LOCAL}/src/${GO_AGENT_PKG}" - else - # The PATH /.cargo/bin is apparently wrong - # 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 + bash ${script_dir}/../../../ci/install_musl.sh + # rust agent needs ${arch}-unknown-linux-musl + rustup show | grep linux-musl > /dev/null || bash ${script_dir}/../../../ci/install_rust.sh + test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env" + [ "$ARCH" == "aarch64" ] && OLD_PATH=$PATH && export PATH=$PATH:/usr/local/musl/bin - info "Pull Agent source code" - go get -d "${agent_pkg}" || true - OK "Pull Agent source code" + agent_pkg="${RUST_AGENT_PKG}" + agent_dir="${script_dir}/../../../src/agent/" + # For now, rust-agent doesn't support seccomp yet. + SECCOMP="no" info "Build agent" pushd "${agent_dir}" @@ -577,6 +556,7 @@ EOT make clean make LIBC=${LIBC} INIT=${AGENT_INIT} make install DESTDIR="${ROOTFS_DIR}" LIBC=${LIBC} INIT=${AGENT_INIT} SECCOMP=${SECCOMP} + [ "$ARCH" == "aarch64" ] && export PATH=$OLD_PATH && rm -rf /usr/local/musl popd else cp ${AGENT_SOURCE_BIN} ${AGENT_DEST} @@ -624,18 +604,10 @@ parse_arguments() distro="$1" 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 - die "Cannot build rust agent on ppc64le. -musl cannot be built on ppc64le because of long double -reprentation is broken. And rust has no musl target on ppc64le. + die "Cannot build rust agent on s390x +musl cannot be built on s390x because of long double +reprentation is broken. And rust has no musl target on s390x. See issue: https://github.com/kata-containers/osbuilder/issues/388" fi } @@ -673,8 +645,10 @@ main() prepare_overlay fi - init="${ROOTFS_DIR}/sbin/init" - setup_rootfs + if [ "$STAGE_PREPARE_ROOTFS" == "" ]; then + init="${ROOTFS_DIR}/sbin/init" + setup_rootfs + fi } main $* diff --git a/tools/osbuilder/scripts/lib.sh b/tools/osbuilder/scripts/lib.sh index bd76bb3cce..dbd6b3dbde 100644 --- a/tools/osbuilder/scripts/lib.sh +++ b/tools/osbuilder/scripts/lib.sh @@ -7,15 +7,11 @@ set -e KATA_REPO=${KATA_REPO:-github.com/kata-containers/kata-containers} -KATA_REPO_DIR="${GOPATH}/src/${KATA_REPO}" CMAKE_VERSION=${CMAKE_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 -KATA_BRANCH=${branch:-} -KATA_BRANCH=${KATA_BRANCH:-master} -yq_file="${script_dir}/../scripts/install-yq.sh" -kata_versions_file="${KATA_REPO_DIR}/versions.yaml" +yq_file="${script_dir}/../../../ci/install_yq.sh" +kata_versions_file="${script_dir}/../../../versions.yaml" error() { @@ -199,7 +195,7 @@ create_summary_file() if [ "${RUST_AGENT}" == "no" ]; then agent_version=$("$agent" --version|awk '{print $NF}') else - local -r agentdir="${GOPATH}/src/${KATA_REPO}/src/agent" + local -r agentdir="${script_dir}/../../../" agent_version=$(cat ${agentdir}/VERSION) fi diff --git a/tools/packaging/kata-deploy/action/test-kata.sh b/tools/packaging/kata-deploy/action/test-kata.sh index ff24dff07f..983e06417d 100755 --- a/tools/packaging/kata-deploy/action/test-kata.sh +++ b/tools/packaging/kata-deploy/action/test-kata.sh @@ -57,7 +57,7 @@ function waitForLabelRemoval() { } function run_test() { - YAMLPATH="./kata-deploy" + YAMLPATH="./tools/packaging/kata-deploy/" echo "verify connectivity with a pod using Kata" deployment="" @@ -97,20 +97,20 @@ function test_kata() { [[ -z "$PKG_SHA" ]] && die "no PKG_SHA provided" + YAMLPATH="./tools/packaging/kata-deploy/" + # This action could be called in two contexts: # 1. Packaging workflows: testing in packaging repository, where we assume yaml/packaging # bits under test are already part of teh action workspace. # 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 - if [[ ! -d ./kata-deploy ]]; then - [[ -d packaging ]] || git clone https://github.com/kata-containers/packaging packaging - cd packaging + if [[ ! -d $YAMLPATH ]]; then + [[ -d $YAMLPATH ]] || git clone https://github.com/kata-containers/kata-containers + cd kata-containers git fetch git checkout $PKG_SHA fi - YAMLPATH="./kata-deploy" - kubectl apply -f "$YAMLPATH/kata-rbac/base/kata-rbac.yaml" # apply runtime classes: diff --git a/tools/packaging/kernel/build-kernel.sh b/tools/packaging/kernel/build-kernel.sh index e20f4196f8..4e5549241b 100755 --- a/tools/packaging/kernel/build-kernel.sh +++ b/tools/packaging/kernel/build-kernel.sh @@ -27,18 +27,16 @@ kernel_version="" # Flag know if need to download the kernel source download_kernel=false # 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 patches_repo="github.com/${project_name}/kata-containers/tools/packaging" readonly patches_repo_dir="${GOPATH}/src/${patches_repo}" # 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 -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 -readonly default_config_frags_dir="${GOPATH}/src/${kernel_config_repo}/kernel/configs/fragments" -readonly default_config_whitelist="${GOPATH}/src/${kernel_config_repo}/kernel/configs/fragments/whitelist.conf" +readonly default_config_frags_dir="${script_dir}/configs/fragments" +readonly default_config_whitelist="${script_dir}/configs/fragments/whitelist.conf" # GPU vendor readonly GV_INTEL="intel" readonly GV_NVIDIA="nvidia" @@ -291,16 +289,6 @@ get_default_kernel_config() { get_config_and_patches() { if [ -z "${patches_path}" ]; then 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 } diff --git a/tools/packaging/kernel/configs/fragments/whitelist.conf b/tools/packaging/kernel/configs/fragments/whitelist.conf index e4e6845270..98f79aa0c1 100644 --- a/tools/packaging/kernel/configs/fragments/whitelist.conf +++ b/tools/packaging/kernel/configs/fragments/whitelist.conf @@ -7,3 +7,4 @@ CONFIG_NF_NAT_PROTO_GRE CONFIG_NF_NAT_PROTO_SCTP CONFIG_NF_NAT_PROTO_UDPLITE CONFIG_REFCOUNT_FULL +CONFIG_MEMCG_SWAP_ENABLED diff --git a/tools/packaging/kernel/patches/virtio-fs-dev.virtio-fs-dev.x/0001-net-virtio_vsock-Fix-race-condition-between-bind-and.patch b/tools/packaging/kernel/patches/virtio-fs-dev.virtio-fs-dev.x/0001-net-virtio_vsock-Fix-race-condition-between-bind-and.patch deleted file mode 100644 index bb15836faf..0000000000 --- a/tools/packaging/kernel/patches/virtio-fs-dev.virtio-fs-dev.x/0001-net-virtio_vsock-Fix-race-condition-between-bind-and.patch +++ /dev/null @@ -1,49 +0,0 @@ -From c7ec155ec5e0f573e9c3cc4eb38d47543a2f1e81 Mon Sep 17 00:00:00 2001 -From: Sebastien Boeuf -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 ---- - 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 - diff --git a/tools/packaging/obs-packaging/download_image.sh b/tools/packaging/obs-packaging/download_image.sh index a3e4330db1..48f4243a1a 100755 --- a/tools/packaging/obs-packaging/download_image.sh +++ b/tools/packaging/obs-packaging/download_image.sh @@ -49,5 +49,5 @@ echo "$commit" agent_repository="github.com/kata-containers/agent" tarball_name="kata-containers-${version}-${commit:0:${short_commit_length}}-$(uname -m).tar.gz" image_url="https://${agent_repository}/releases/download/${version}/${tarball_name}" -curl -OL "${image_url}" -tar xvf "${tarball_name}" +#curl -OL "${image_url}" +#tar xvf "${tarball_name}" diff --git a/tools/packaging/obs-packaging/gen_versions_txt.sh b/tools/packaging/obs-packaging/gen_versions_txt.sh index f4f9bda215..027a3fe9e3 100755 --- a/tools/packaging/obs-packaging/gen_versions_txt.sh +++ b/tools/packaging/obs-packaging/gen_versions_txt.sh @@ -20,8 +20,7 @@ source "${script_dir}/../scripts/lib.sh" ARCH=${ARCH:-$(arch_to_golang "$(uname -m)")} get_kata_version() { - local branch="$1" - curl -SsL "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION" + cat "${script_dir}/../../../VERSION" } gen_version_file() { @@ -36,12 +35,6 @@ gen_version_file() { ref="refs/tags/${kata_version}^{}" 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}") # 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}" @@ -57,32 +50,16 @@ gen_version_file() { kernel_version=${kernel_version#v} 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 # see https://github.com/semver/semver/issues/145 - kata_version=$(get_kata_version "${branch}") + kata_version=$(get_kata_version) kata_version=${kata_version/-/\~} cat > "$versions_txt" <> /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 rm -rf ${repo_dir} @@ -191,7 +167,7 @@ main() { if [ -n "${use_head}" ]; then kata_version="HEAD" else - kata_version=$(get_kata_version "${branch}") + kata_version=$(get_kata_version) fi fi @@ -201,7 +177,7 @@ main() { [ -n "${kata_version}" ] || die "${version_file} does not contain a valid kata_version variable" # Replacing ~ with -, as - is not a valid char for rpmbuild # 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}" return fi diff --git a/tools/packaging/obs-packaging/kata-containers-image/build_image.sh b/tools/packaging/obs-packaging/kata-containers-image/build_image.sh index 5a15f3f3f8..fdd16f6021 100755 --- a/tools/packaging/obs-packaging/kata-containers-image/build_image.sh +++ b/tools/packaging/obs-packaging/kata-containers-image/build_image.sh @@ -13,9 +13,7 @@ set -o pipefail readonly script_name="$(basename "${BASH_SOURCE[0]}")" readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly project="kata-containers" 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=${GOPATH:-${HOME}/go} @@ -29,16 +27,7 @@ trap exit_handler EXIT arch_target="$(uname -m)" -kata_version="master" - -# 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 +source "${script_dir}/../versions.txt" readonly destdir="${PWD}" @@ -46,7 +35,6 @@ build_initrd() { sudo -E PATH="$PATH" make initrd \ DISTRO="$initrd_distro" \ DEBUG="${DEBUG:-}" \ - AGENT_VERSION="${agent_version}" \ OS_VERSION="${initrd_os_version}" \ ROOTFS_BUILD_DEST="${tmp_dir}/initrd-image" \ USE_DOCKER=1 \ @@ -59,21 +47,20 @@ build_image() { DISTRO="${img_distro}" \ DEBUG="${DEBUG:-}" \ USE_DOCKER="1" \ - AGENT_VERSION="${agent_version}" \ IMG_OS_VERSION="${img_os_version}" \ ROOTFS_BUILD_DEST="${tmp_dir}/rootfs-image" } 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 agent_sha=${agent_sha:0:${short_commit_length}} - tarball_name="kata-containers-${osbuider_version}-${agent_sha}-${arch_target}.tar.gz" - image_name="kata-containers-image_${img_distro}_${osbuider_version}_agent_${agent_sha}.img" - initrd_name="kata-containers-initrd_${initrd_distro}_${osbuider_version}_agent_${agent_sha}.initrd" + tarball_name="kata-containers-${kata_version}-${agent_sha}-${arch_target}.tar.gz" + image_name="kata-containers-image_${img_distro}_${kata_version}_agent_${agent_sha}.img" + initrd_name="kata-containers-initrd_${initrd_distro}_${kata_version}_agent_${agent_sha}.initrd" - mv "${tmp_dir}/osbuilder/kata-containers.img" "${image_name}" - mv "${tmp_dir}/osbuilder/kata-containers-initrd.img" "${initrd_name}" + mv "${script_dir}/../../../osbuilder/kata-containers.img" "${image_name}" + mv "${script_dir}/../../../osbuilder/kata-containers-initrd.img" "${initrd_name}" sudo tar cfzv "${tarball_name}" "${initrd_name}" "${image_name}" } @@ -106,10 +93,6 @@ main() { ;; esac done - # osbuilder info - [ -n "${osbuider_version}" ] || osbuider_version="${kata_version}" - # Agent version - [ -n "${agent_version}" ] || agent_version="${kata_version}" install_yq @@ -126,9 +109,7 @@ main() { 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" - git checkout "${osbuider_version}" + pushd "${script_dir}/../../../osbuilder/" build_initrd build_image create_tarball diff --git a/tools/packaging/obs-packaging/ksm-throttler/_service-template b/tools/packaging/obs-packaging/ksm-throttler/_service-template deleted file mode 100644 index 6e641adb95..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/_service-template +++ /dev/null @@ -1,24 +0,0 @@ - - - - git - https://github.com/kata-containers/ksm-throttler.git - kata-ksm-throttler - @VERSION@ - @HASH@ - - - *.tar* - gz - - - https - storage.googleapis.com - golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz - - - _service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz - sha256 - @GO_CHECKSUM@ - - diff --git a/tools/packaging/obs-packaging/ksm-throttler/debian.compat b/tools/packaging/obs-packaging/ksm-throttler/debian.compat deleted file mode 100644 index ec635144f6..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/debian.compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/tools/packaging/obs-packaging/ksm-throttler/debian.control-template b/tools/packaging/obs-packaging/ksm-throttler/debian.control-template deleted file mode 100644 index 0c4b4c5a8b..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/debian.control-template +++ /dev/null @@ -1,13 +0,0 @@ -Source: kata-ksm-throttler -Section: devel -Priority: optional -Maintainer: Kata containers team -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. diff --git a/tools/packaging/obs-packaging/ksm-throttler/debian.rules-template b/tools/packaging/obs-packaging/ksm-throttler/debian.rules-template deleted file mode 100644 index c4dc9a7b59..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/debian.rules-template +++ /dev/null @@ -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 - diff --git a/tools/packaging/obs-packaging/ksm-throttler/kata-ksm-throttler.dsc-template b/tools/packaging/obs-packaging/ksm-throttler/kata-ksm-throttler.dsc-template deleted file mode 100644 index b8b77334c6..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/kata-ksm-throttler.dsc-template +++ /dev/null @@ -1,16 +0,0 @@ -Format: 3.0 (quilt) -Source: kata-ksm-throttler -Version: @VERSION@-@RELEASE@ -Section: devel -Priority: optional -Maintainer: Kata containers team -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. diff --git a/tools/packaging/obs-packaging/ksm-throttler/kata-ksm-throttler.spec-template b/tools/packaging/obs-packaging/ksm-throttler/kata-ksm-throttler.spec-template deleted file mode 100644 index fbbdbf6ef8..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/kata-ksm-throttler.spec-template +++ /dev/null @@ -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 diff --git a/tools/packaging/obs-packaging/ksm-throttler/update.sh b/tools/packaging/obs-packaging/ksm-throttler/update.sh deleted file mode 100755 index 004d6ee1ff..0000000000 --- a/tools/packaging/obs-packaging/ksm-throttler/update.sh +++ /dev/null @@ -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}" diff --git a/tools/packaging/obs-packaging/proxy/_service-template b/tools/packaging/obs-packaging/proxy/_service-template deleted file mode 100644 index 26c538282a..0000000000 --- a/tools/packaging/obs-packaging/proxy/_service-template +++ /dev/null @@ -1,24 +0,0 @@ - - - - git - https://github.com/kata-containers/proxy.git - kata-proxy - @VERSION@ - @HASH@ - - - *.tar* - gz - - - https - storage.googleapis.com - golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz - - - _service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz - sha256 - @GO_CHECKSUM@ - - diff --git a/tools/packaging/obs-packaging/proxy/debian.compat b/tools/packaging/obs-packaging/proxy/debian.compat deleted file mode 100644 index ec635144f6..0000000000 --- a/tools/packaging/obs-packaging/proxy/debian.compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/tools/packaging/obs-packaging/proxy/debian.control-template b/tools/packaging/obs-packaging/proxy/debian.control-template deleted file mode 100644 index 297dbd1157..0000000000 --- a/tools/packaging/obs-packaging/proxy/debian.control-template +++ /dev/null @@ -1,13 +0,0 @@ -Source: kata-proxy -Section: devel -Priority: optional -Maintainer: Kata containers team -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. diff --git a/tools/packaging/obs-packaging/proxy/debian.rules-template b/tools/packaging/obs-packaging/proxy/debian.rules-template deleted file mode 100644 index 4642549123..0000000000 --- a/tools/packaging/obs-packaging/proxy/debian.rules-template +++ /dev/null @@ -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@ diff --git a/tools/packaging/obs-packaging/proxy/kata-proxy.dsc-template b/tools/packaging/obs-packaging/proxy/kata-proxy.dsc-template deleted file mode 100644 index a89497eb76..0000000000 --- a/tools/packaging/obs-packaging/proxy/kata-proxy.dsc-template +++ /dev/null @@ -1,16 +0,0 @@ -format: 3.0 (quilt) -Source: kata-proxy -Version: @VERSION@-@RELEASE@ -Section: devel -Priority: optional -Maintainer: Kata containers team -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. diff --git a/tools/packaging/obs-packaging/proxy/kata-proxy.spec-template b/tools/packaging/obs-packaging/proxy/kata-proxy.spec-template deleted file mode 100644 index 7298480611..0000000000 --- a/tools/packaging/obs-packaging/proxy/kata-proxy.spec-template +++ /dev/null @@ -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 diff --git a/tools/packaging/obs-packaging/proxy/update.sh b/tools/packaging/obs-packaging/proxy/update.sh deleted file mode 100755 index 2c9e28fc0a..0000000000 --- a/tools/packaging/obs-packaging/proxy/update.sh +++ /dev/null @@ -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}" diff --git a/tools/packaging/obs-packaging/runtime/_service-template b/tools/packaging/obs-packaging/runtime/_service-template index f05e57d26d..c4bbd5af4c 100644 --- a/tools/packaging/obs-packaging/runtime/_service-template +++ b/tools/packaging/obs-packaging/runtime/_service-template @@ -3,7 +3,7 @@ git - https://github.com/kata-containers/runtime.git + https://github.com/kata-containers/kata-containers.git kata-runtime @VERSION@ diff --git a/tools/packaging/obs-packaging/runtime/debian.control-template b/tools/packaging/obs-packaging/runtime/debian.control-template index 20f85f7230..8a7024577b 100644 --- a/tools/packaging/obs-packaging/runtime/debian.control-template +++ b/tools/packaging/obs-packaging/runtime/debian.control-template @@ -11,9 +11,6 @@ Package: kata-runtime Architecture: @deb_arch@ Depends: kata-containers-image (= @kata_osbuilder_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@) Description: An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x diff --git a/tools/packaging/obs-packaging/runtime/kata-runtime.dsc-template b/tools/packaging/obs-packaging/runtime/kata-runtime.dsc-template index 9f79440857..cf749ee84b 100644 --- a/tools/packaging/obs-packaging/runtime/kata-runtime.dsc-template +++ b/tools/packaging/obs-packaging/runtime/kata-runtime.dsc-template @@ -16,9 +16,6 @@ Package: kata-runtime Architecture: @deb_arch@ Depends: kata-containers-image (= @kata_osbuilder_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@) Description: An Open Containers Initiative (OCI) "runtime" that launches an Intel VT-x diff --git a/tools/packaging/obs-packaging/runtime/kata-runtime.spec-template b/tools/packaging/obs-packaging/runtime/kata-runtime.spec-template index 4118024ab0..7600b6ffde 100644 --- a/tools/packaging/obs-packaging/runtime/kata-runtime.spec-template +++ b/tools/packaging/obs-packaging/runtime/kata-runtime.spec-template @@ -26,9 +26,6 @@ BuildRequires: git Requires: kata-containers-image = @kata_osbuilder_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@ # Patches diff --git a/tools/packaging/obs-packaging/runtime/update.sh b/tools/packaging/obs-packaging/runtime/update.sh index 9c319578ca..08718993f6 100755 --- a/tools/packaging/obs-packaging/runtime/update.sh +++ b/tools/packaging/obs-packaging/runtime/update.sh @@ -90,37 +90,18 @@ cli "$@" declare -a pkgVersions # Package depedencies 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 pkgVersions=($(pkg_required_ver "kernel")) KERNEL_REQUIRED_VERSION["deb"]=${pkgVersions[0]} KERNEL_REQUIRED_VERSION["rpm"]=${pkgVersions[1]} 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 pkgVersions=($(pkg_required_ver "kata_osbuilder")) KATA_IMAGE_REQUIRED_VERSION["deb"]=${pkgVersions[0]} KATA_IMAGE_REQUIRED_VERSION["rpm"]=${pkgVersions[1]} info "image ${KATA_IMAGE_REQUIRED_VERSION[@]}" - declare -A KATA_QEMU_VANILLA_REQUIRED_VERSION pkgVersions=($(pkg_required_ver "qemu_vanilla")) KATA_QEMU_VANILLA_REQUIRED_VERSION["deb"]=${pkgVersions[0]} @@ -140,14 +121,6 @@ replace_list+=( "HASH=$short_hashtag" "RELEASE=$RELEASE" "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_release=${KERNEL_REQUIRED_VERSION["deb"]}" "qemu_vanilla_version=${KATA_QEMU_VANILLA_REQUIRED_VERSION["rpm"]}" diff --git a/tools/packaging/obs-packaging/scripts/obs-pkgs.sh b/tools/packaging/obs-packaging/scripts/obs-pkgs.sh index 13331e62b7..cb6d52d6d4 100755 --- a/tools/packaging/obs-packaging/scripts/obs-pkgs.sh +++ b/tools/packaging/obs-packaging/scripts/obs-pkgs.sh @@ -15,8 +15,5 @@ OBS_PKGS_PROJECTS+=( qemu-vanilla linux-container kata-containers-image - proxy - shim - ksm-throttler runtime ) diff --git a/tools/packaging/obs-packaging/shim/_service-template b/tools/packaging/obs-packaging/shim/_service-template deleted file mode 100644 index 92c7358b7e..0000000000 --- a/tools/packaging/obs-packaging/shim/_service-template +++ /dev/null @@ -1,24 +0,0 @@ - - - - git - https://github.com/kata-containers/shim.git - kata-shim - @VERSION@ - @HASH@ - - - *.tar* - gz - - - https - storage.googleapis.com - golang/go@GO_VERSION@.linux-@GO_ARCH@.tar.gz - - - _service:download_url:go@GO_VERSION@.linux-@GO_ARCH@.tar.gz - sha256 - @GO_CHECKSUM@ - - diff --git a/tools/packaging/obs-packaging/shim/debian.compat b/tools/packaging/obs-packaging/shim/debian.compat deleted file mode 100644 index ec635144f6..0000000000 --- a/tools/packaging/obs-packaging/shim/debian.compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/tools/packaging/obs-packaging/shim/debian.control-template b/tools/packaging/obs-packaging/shim/debian.control-template deleted file mode 100644 index 11d3fd9f52..0000000000 --- a/tools/packaging/obs-packaging/shim/debian.control-template +++ /dev/null @@ -1,14 +0,0 @@ -Source: kata-shim -Section: devel -Priority: optional -Maintainer: Kata containers team -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. - diff --git a/tools/packaging/obs-packaging/shim/debian.rules-template b/tools/packaging/obs-packaging/shim/debian.rules-template deleted file mode 100644 index dfea7abbe1..0000000000 --- a/tools/packaging/obs-packaging/shim/debian.rules-template +++ /dev/null @@ -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@ diff --git a/tools/packaging/obs-packaging/shim/kata-shim.dsc-template b/tools/packaging/obs-packaging/shim/kata-shim.dsc-template deleted file mode 100644 index fbe4cb42b3..0000000000 --- a/tools/packaging/obs-packaging/shim/kata-shim.dsc-template +++ /dev/null @@ -1,17 +0,0 @@ -Format: 3.0 (quilt) -Source: kata-shim -Version: @VERSION@-@RELEASE@ -Section: devel -Priority: optional -Maintainer: Kata containers team -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. - diff --git a/tools/packaging/obs-packaging/shim/kata-shim.spec-template b/tools/packaging/obs-packaging/shim/kata-shim.spec-template deleted file mode 100644 index 4cdb88de29..0000000000 --- a/tools/packaging/obs-packaging/shim/kata-shim.spec-template +++ /dev/null @@ -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 diff --git a/tools/packaging/obs-packaging/shim/update.sh b/tools/packaging/obs-packaging/shim/update.sh deleted file mode 100755 index cc5aa081c3..0000000000 --- a/tools/packaging/obs-packaging/shim/update.sh +++ /dev/null @@ -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}" diff --git a/tools/packaging/release/README.md b/tools/packaging/release/README.md index d3ffce1b06..d2f1a4446f 100644 --- a/tools/packaging/release/README.md +++ b/tools/packaging/release/README.md @@ -31,37 +31,24 @@ $ ./update-repository-version.sh -h ### Update Kata projects to a new version -Kata Containers is divided into multiple projects. With each release, all -project versions are updated to keep the version consistent. - -To update all versions for all projects, use the following: +To update project version for Kata Containers, use the following: ```bash $ make bump-kata-version NEW_VERSION= ``` 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 merged by Kata Containers members. ### `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. -The `tag_repos.sh` script is used to create tags for the Kata Containers -repositories. This script ensures that all the repositories are in the same -version (by checking the `VERSION` file). - +The `tag_repos.sh` script is used to create tags for the Kata Containers repository. The script creates an **annotated tag** for the new release version for the following repositories: -- agent -- 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. +- kata-containers diff --git a/tools/packaging/release/kata-deploy-binaries.sh b/tools/packaging/release/kata-deploy-binaries.sh index 00b67d7491..a8105cb976 100755 --- a/tools/packaging/release/kata-deploy-binaries.sh +++ b/tools/packaging/release/kata-deploy-binaries.sh @@ -13,7 +13,7 @@ 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 project_to_attach="github.com/${project}/${project}" readonly tmp_dir=$(mktemp -d -t static-build-tmp.XXXXXXXXXX) readonly GOPATH="${tmp_dir}/go" # flag to decide if push tarball to github @@ -32,12 +32,6 @@ exit_handler() { } trap exit_handler EXIT -projects=( - proxy - runtime - shim -) - die() { msg="$*" echo "ERROR: ${msg}" >&2 @@ -201,22 +195,18 @@ install_docker_config_script() { #Install all components that are not assets install_kata_components() { kata_version=${1:-$kata_version} - 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" - echo "Install" - make PREFIX="${prefix}" \ - DESTDIR="${destdir}" \ - install - popd >>/dev/null - done + pushd "${script_dir}/../../../src/runtime" + echo "Checkout to version ${kata_version}" + git checkout "${kata_version}" + echo "Build" + make \ + PREFIX="${prefix}" \ + QEMUCMD="qemu-system-x86_64" + echo "Install" + make PREFIX="${prefix}" \ + DESTDIR="${destdir}" \ + install + popd 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" pushd "${destdir}/${prefix}/share/defaults/${project}" @@ -300,7 +290,7 @@ main() { 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}" + hub -C "${GOPATH}/src/github.com/${project}/${project}" release edit -a "${tarball_name}" "${kata_version}" else echo "Wont push the tarball to github use -p option to do it." fi diff --git a/tools/packaging/release/tag_repos.sh b/tools/packaging/release/tag_repos.sh index e3e6f07298..e8878d9264 100755 --- a/tools/packaging/release/tag_repos.sh +++ b/tools/packaging/release/tag_repos.sh @@ -68,15 +68,6 @@ info() { } repos=( - "agent" - "documentation" - "ksm-throttler" - "osbuilder" - "packaging" - "proxy" - "runtime" - "shim" - "tests" "kata-containers" ) @@ -208,7 +199,7 @@ main () { subcmd=${1:-""} 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 diff --git a/tools/packaging/release/tag_repos_test.sh b/tools/packaging/release/tag_repos_test.sh index be41c90b86..51c08c9145 100755 --- a/tools/packaging/release/tag_repos_test.sh +++ b/tools/packaging/release/tag_repos_test.sh @@ -16,10 +16,10 @@ echo "Check tag_repos.sh -h option" ./release/tag_repos.sh -h | grep Usage 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" -./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" ./release/tag_repos.sh pre-release 1000000 | grep "ERROR" || true diff --git a/tools/packaging/release/update-repository-version.sh b/tools/packaging/release/update-repository-version.sh index 003e40437c..4651b4cf88 100755 --- a/tools/packaging/release/update-repository-version.sh +++ b/tools/packaging/release/update-repository-version.sh @@ -164,16 +164,7 @@ EOT } repos=( - "agent" - "documentation" "kata-containers" - "ksm-throttler" - "osbuilder" - "packaging" - "proxy" - "runtime" - "shim" - "tests" ) main(){ diff --git a/tools/packaging/scripts/lib.sh b/tools/packaging/scripts/lib.sh index f809defacd..c4fe53f82e 100644 --- a/tools/packaging/scripts/lib.sh +++ b/tools/packaging/scripts/lib.sh @@ -9,6 +9,8 @@ export GOPATH=${GOPATH:-${HOME}/go} export tests_repo="${tests_repo:-github.com/kata-containers/tests}" export tests_repo_dir="$GOPATH/src/$tests_repo" +this_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + hub_bin="hub-bin" clone_tests_repo() { @@ -32,16 +34,14 @@ get_from_kata_deps() { local dependency="$1" BRANCH=${branch:-master} local branch="${2:-${BRANCH}}" - local runtime_repo="github.com/kata-containers/kata-containers" 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 # 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 # repository will pass the kernel version as an override to this function to # allow testing of kernels before they land in tree. - if [ "${CI:-}" = "true" ] && [ -d "${runtime_repo_dir}" ]; then - versions_file="${runtime_repo_dir}/versions.yaml" + if [ "${CI:-}" = "true" ]; then + versions_file="${this_script_dir}/../../../versions.yaml" else versions_file="versions-${branch}.yaml" fi @@ -50,10 +50,7 @@ get_from_kata_deps() { install_yq >&2 if [ ! -e "${versions_file}" ]; then - yaml_url="https://raw.githubusercontent.com/kata-containers/runtime/${branch}/versions.yaml" - echo "versions file (${versions_file}) does not exist" >&2 - echo "Download from ${yaml_url}" >&2 - curl --silent -o "${versions_file}" "$yaml_url" + cp "${this_script_dir}/../../../versions.yaml" ${versions_file} fi result=$("${GOPATH}/bin/yq" read -X "$versions_file" "$dependency") [ "$result" = "null" ] && result="" diff --git a/versions.yaml b/versions.yaml index 915b23f9f9..ad6a2d271a 100644 --- a/versions.yaml +++ b/versions.yaml @@ -114,7 +114,7 @@ assets: description: | Root filesystem disk image used to boot the guest virtual machine. - url: "https://github.com/kata-containers/osbuilder" + url: "https://github.com/kata-containers/kata-containers/tools/osbuilder" architecture: aarch64: name: "ubuntu" @@ -135,7 +135,7 @@ assets: description: | Root filesystem initrd used to boot the guest virtual machine. - url: "https://github.com/kata-containers/osbuilder" + url: "https://github.com/kata-containers/kata-containers/tools/osbuilder" architecture: aarch64: name: &default-initrd-name "alpine" @@ -162,16 +162,6 @@ assets: url: "https://gitlab.com/virtio-fs/linux.git" 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: description: "Third-party projects used by the system"