From fceaa1d6ece8c9ce879a79155fea9debf565995f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 9 Mar 2021 23:26:32 +0000 Subject: [PATCH] ci: Rework to split build/test Aiming to fix https://github.com/openshift/os/issues/506 I think the problem here may be related to the fact that we're trying to do all of our CI as part of a build. Instead, let's function like e.g. the CI for coreos/rpm-ostree which creates a derived container from the source code. For us, this derived container is basically the 2-tuple (source, cosa). For coreos/rpm-ostree we actually do generate binaries as well as test code from the buildroot, i.e. a 3 tuple (binaries, test binaries, cosa). But here we don't need that, there's no actual "build" step. Split off `validate.sh` as a separate thing that can be a clearly separate step. --- Dockerfile | 5 ----- ci/Dockerfile | 5 +++++ ci/build-test-qemu.sh | 25 +++++++++++++++++++++++++ ci/build-test.sh | 21 +-------------------- ci/validate.sh | 6 ++++++ 5 files changed, 37 insertions(+), 25 deletions(-) delete mode 100644 Dockerfile create mode 100644 ci/Dockerfile create mode 100755 ci/build-test-qemu.sh mode change 100755 => 120000 ci/build-test.sh create mode 100755 ci/validate.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d9df511d..00000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -# This Dockerfile *used* to run rpm-ostree, but -# we now have a custom build process. We're just -# keeping this Dockerfile around as there's a Prow -# job that looks at it. -FROM registry.fedoraproject.org/fedora:28 diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 00000000..ecf16374 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,5 @@ +# For CI on a config git repo, all we need to do is combine +# the source code with coreos-assembler into an image to test. +FROM registry.svc.ci.openshift.org/coreos/coreos-assembler:latest +WORKDIR /src +COPY . . diff --git a/ci/build-test-qemu.sh b/ci/build-test-qemu.sh new file mode 100755 index 00000000..7c30d9ce --- /dev/null +++ b/ci/build-test-qemu.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -xeuo pipefail +# Prow jobs don't support adding emptydir today +export COSA_SKIP_OVERLAY=1 +# We generate .repo files which write to the source, but +# we captured the source as part of the Docker build. +# In OpenShift default SCC we'll run as non-root, so we need +# to make a new copy of the source. TODO fix cosa to be happy +# if src/config already exists instead of wanting to reference +# it or clone it. Or we could write our .repo files to a separate +# place. +tmpsrc=$(mktemp -d) +cp -a /src ${tmpsrc}/src +# Create a temporary cosa workdir +cd $(mktemp -d) +cosa init ${tmpsrc}/src +# TODO query the 4-8 bits from manifest.yaml or so +curl -L http://base-4-8-rhel8.ocp.svc.cluster.local > src/config/ocp.repo +cosa fetch +cosa build +cosa kola --basic-qemu-scenarios +cosa kola run 'ext.*' +# TODO: all tests in the future, but there are a lot +# and we want multiple tiers, and we need to split them +# into multiple pods and stuff. diff --git a/ci/build-test.sh b/ci/build-test.sh deleted file mode 100755 index d0d38168..00000000 --- a/ci/build-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -xeuo pipefail -# First ensure submodules are initialized -git submodule update --init --recursive -# Basic syntax check -./fedora-coreos-config/ci/validate -# Prow jobs don't support adding emptydir today -export COSA_SKIP_OVERLAY=1 -gitdir=$(pwd) -cd $(mktemp -d) -cosa init ${gitdir} -# TODO query the 4-8 bits from manifest.yaml or so -curl -L http://base-4-8-rhel8.ocp.svc.cluster.local > src/config/ocp.repo -cosa fetch -cosa build -cosa kola --basic-qemu-scenarios -cosa kola run 'ext.*' -# TODO: all tests in the future, but there are a lot -# and we want multiple tiers, and we need to split them -# into multiple pods and stuff. diff --git a/ci/build-test.sh b/ci/build-test.sh new file mode 120000 index 00000000..98ce07eb --- /dev/null +++ b/ci/build-test.sh @@ -0,0 +1 @@ +validate.sh \ No newline at end of file diff --git a/ci/validate.sh b/ci/validate.sh new file mode 100755 index 00000000..d5e68ea6 --- /dev/null +++ b/ci/validate.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -xeuo pipefail +# First ensure submodules are initialized +git submodule update --init --recursive +# Basic syntax check +./fedora-coreos-config/ci/validate