From 9281e56705f8d45abf280d53973bb9459025a7e9 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Mon, 5 Apr 2021 14:01:32 -0400 Subject: [PATCH 1/2] ci/openshift-ci: Add build root dockerfile This adds the dockerfile which is used by the OpenShift CI operator to build the build root image. It is installed git as it is required by the operator to clone repositories. The sudo package is also installed because many scripts relies on the command but it is not installed by tests/.ci/setup_env_centos.sh. Fixes #1636 Signed-off-by: Wainer dos Santos Moschetta --- ci/openshift-ci/images/Dockerfile.buildroot | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 ci/openshift-ci/images/Dockerfile.buildroot diff --git a/ci/openshift-ci/images/Dockerfile.buildroot b/ci/openshift-ci/images/Dockerfile.buildroot new file mode 100644 index 0000000000..4cdc58e385 --- /dev/null +++ b/ci/openshift-ci/images/Dockerfile.buildroot @@ -0,0 +1,9 @@ +# Copyright (c) 2021 Red Hat, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This is the build root image for Kata Containers on OpenShift CI. +# +FROM centos:8 + +RUN yum -y update && yum -y install git sudo wget From 16f732fc18728ecc1badb62359fb7f4df434d5ae Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Mon, 5 Apr 2021 16:49:13 -0400 Subject: [PATCH 2/2] ci/lib: Use git to clone the tests repository On clone_tests_repo() use git instead of `go get` to clone and/or update the tests repository. Signed-off-by: Wainer dos Santos Moschetta --- ci/lib.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ci/lib.sh b/ci/lib.sh index efffc1cccc..de816a4a5c 100644 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -7,16 +7,25 @@ export tests_repo="${tests_repo:-github.com/kata-containers/tests}" export tests_repo_dir="$GOPATH/src/$tests_repo" export branch="${branch:-main}" +# Clones the tests repository and checkout to the branch pointed out by +# the global $branch variable. +# If the clone exists and `CI` is exported then it does nothing. Otherwise +# it will clone the repository or `git pull` the latest code. +# clone_tests_repo() { - if [ -d "$tests_repo_dir" -a -n "$CI" ] - then - return + if [ -d "$tests_repo_dir" ]; then + [ -n "$CI" ] && return + pushd "${tests_repo_dir}" + git checkout "${branch}" + git pull + popd + else + git clone -q "https://${tests_repo}" "$tests_repo_dir" + pushd "${tests_repo_dir}" + git checkout "${branch}" + popd fi - - go get -d -u "$tests_repo" || true - - pushd "${tests_repo_dir}" && git checkout "${branch}" && popd } run_static_checks()