ci: Introduce $(CI_PREPARE_SCRIPT)

This script is run before $(CI_BUILD_SCRIPT) and can be used
to tweak the environment as necessary before the build starts.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-08-15 15:24:50 +02:00
parent 82c311013a
commit 2ce3274ea5
3 changed files with 17 additions and 1 deletions

View File

@ -52,6 +52,7 @@ EXTRA_DIST = \
build-aux/vc-list-files \
ci/Makefile \
ci/build.sh \
ci/prepare.sh \
$(NULL)
pkgconfigdir = $(libdir)/pkgconfig

View File

@ -41,6 +41,9 @@ CI_MAKE_ARGS =
# Any extra arguments to pass to configure
CI_CONFIGURE_ARGS =
# Script containing environment preparation steps
CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh
# Script containing build instructions
CI_BUILD_SCRIPT = $(CI_ROOTDIR)/build.sh
@ -100,6 +103,7 @@ CI_HOME_MOUNTS = \
$(NULL)
CI_SCRIPT_MOUNTS = \
--volume $(CI_SCRATCHDIR)/prepare:$(CI_USER_HOME)/prepare:z \
--volume $(CI_SCRATCHDIR)/build:$(CI_USER_HOME)/build:z \
$(NULL)
@ -198,8 +202,9 @@ ci-prepare-tree: ci-check-engine
cp /etc/passwd $(CI_SCRATCHDIR); \
cp /etc/group $(CI_SCRATCHDIR); \
mkdir -p $(CI_SCRATCHDIR)/home; \
cp "$(CI_PREPARE_SCRIPT)" $(CI_SCRATCHDIR)/prepare; \
cp "$(CI_BUILD_SCRIPT)" $(CI_SCRATCHDIR)/build; \
chmod +x "$(CI_SCRATCHDIR)/build"; \
chmod +x "$(CI_SCRATCHDIR)/prepare" "$(CI_SCRATCHDIR)/build"; \
echo "Cloning $(CI_GIT_ROOT) to $(CI_HOST_SRCDIR)"; \
git clone $(CI_GIT_ARGS) $(CI_GIT_ROOT) $(CI_HOST_SRCDIR) || exit 1; \
for mod in $$(git submodule | awk '{ print $$2 }' | sed -E 's,^../,,g') ; \
@ -213,6 +218,7 @@ ci-prepare-tree: ci-check-engine
ci-run-command@%: ci-prepare-tree
$(CI_ENGINE) run $(CI_ENGINE_ARGS) $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \
/bin/bash -c ' \
$(CI_USER_HOME)/prepare || exit 1; \
export CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)"; \
export CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)"; \
export CI_SMP="$(CI_SMP)"; \

9
ci/prepare.sh Normal file
View File

@ -0,0 +1,9 @@
# This script is used to prepare the environment that will be used
# to build libvirt inside the container.
#
# You can customize it to your liking, or alternatively use a
# completely different script by passing
#
# CI_PREPARE_SCRIPT=/path/to/your/prepare/script
#
# to make.