Skip to content

Commit

Permalink
ci/openshift-ci: Onboarding into the OpenShift CI
Browse files Browse the repository at this point in the history
The OpenShift CI allows for components to be built and tested in clusters
provided by the OpenShift community. This adds the minimum required on kata's side to get it onboarded in that CI system.

More precisely, it introduces the buildall_install.sh script which is used
to build and install kata-containers into a container image.

Fixes kata-containers#2527

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm committed Sep 1, 2020
1 parent 5c33835 commit d4e0dcb
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .ci/openshift-ci/buildall_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
#
# Copyright (c) 2020 Red Hat, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Build Kata Containers and install into a given destination directory.
#

set -e

export PATH="${GOPATH}/bin:$PATH"

cidir="$(dirname "$0")/.."
source /etc/os-release || source /usr/lib/os-release
source "${cidir}/lib.sh"

[ -z "$1" ] && die "Usage: $0 path/to/install/dir"
export DESTDIR="$1"
info "Build and install Kata Containers at ${DESTDIR}"

[ "$ID" != "centos" ] && die "Expect the build root to be CentOS"
# The scripts rely on sudo which is not installed in the build environment.
yum install -y sudo
"${cidir}/setup_env_centos.sh" default

# The build root container has already golang installed, let's remove it
# so that it will use the version required by kata.
yum remove -y golang
"${cidir}/install_go.sh" -p -f

# Let's ensure scripts don't try things with Podman.
export TEST_CGROUPSV2="false"

# Configure to use the standard QEMU.
export experimental_qemu="false"
export experimental_kernel="false"

# Configure to use the initrd rootfs.
export TEST_INITRD="yes"

# Configure to use vsock.
# TODO: install_runtime.sh will try to load the vsock module and the script
# fail. See https://github.com/kata-containers/tests/issues/2614
#export USE_VSOCK="yes"

# Configure the QEMU machine type.
export MACHINETYPE="q35"

# Disable SELinux.
export FEATURE_SELINUX="no"

# The default /usr prefix makes the deployment on Red Hat CoreOS (rhcos) more
# complex because that directory is read-only by design. Another prefix than
# /opt/kata is problematic too because QEMU experimental eventually got from
# Kata Containers Jenkins is uncompressed in that directory.
export PREFIX="/opt/kata"

RUN_KATA_CHECK="false" "${cidir}/install_kata.sh"

# The resulting kata installation will be merged in rhcos filesystem, and
# symlinks are troublesome. So instead let's convert them to in-place files.
for ltarget in $(find ${DESTDIR} -type l); do
lsource=$(readlink -f "${ltarget}")
if [ -e "${lsource}" ]; then
unlink "${ltarget}"
cp -fr "${lsource}" "${ltarget}"
fi
done

# The standard QEMU cached in Jenkins is built with /usr/bin prefix, thus it
# needs to adjust the binary path in configuration.toml.
if [ "${PREFIX}" == "/opt/kata" ]; then
sed -i -e 's|^path = "/opt/kata/bin/\(qemu-.*\)"|path = "/usr/bin/\1"|'\
${DESTDIR}/opt/kata/share/defaults/kata-containers/configuration.toml
fi

0 comments on commit d4e0dcb

Please sign in to comment.