From f01a40a77c19661cad48d1542b0510a6af2d5cab Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Tue, 21 Jan 2025 15:39:41 +0100 Subject: [PATCH] tests: unify CI/CD preparation phase We now have GitLab CI/CD pipeline co-existing with spread, coupled with image-garden and the cloud-init profile defined for each distribution. To avoid duplicating list of required dependencies, re-use cloud-init profile as the reference list of dependencies (superset between build and test) to install. In addition to the dependency list, the build_all job now re-uses spread prepare section in similar fashion. If it builds in spread, it should build in CI as well. Signed-off-by: Zygmunt Krynicki --- .gitlab-ci.yml | 56 +++++++++++++++++++++++--------------------------- spread.yaml | 20 ++++++++++++------ 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0dea64ff1..a4222e6b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,21 +14,28 @@ stages: - build - test -.ubuntu-before_script: +.ubuntu-common: before_script: - - export DEBIAN_FRONTEND=noninteractive + # Install build-dependencies by loading the package list from the ubuntu/debian cloud-init profile. - apt-get update -qq - - apt-get install --no-install-recommends -y gcc perl liblocale-gettext-perl linux-libc-dev lsb-release make + - apt-get install --yes yq make lsb-release + - | + printf 'include .image-garden.mk\n$(info $(UBUNTU_CLOUD_INIT_USER_DATA_TEMPLATE))\n.PHONY: nothing\nnothing:\n' \ + | make -f - nothing \ + | yq '.packages | .[]' \ + | xargs apt-get install --yes --no-install-recommends + after_script: + # Inspect the kernel and lsb-release. - lsb_release -a - uname -a -.install-c-build-deps: &install-c-build-deps - - apt-get install --no-install-recommends -y build-essential apache2-dev autoconf autoconf-archive automake bison dejagnu flex libpam-dev libtool pkg-config python3-all-dev python3-setuptools ruby-dev swig zlib1g-dev - build-all: stage: build extends: - - .ubuntu-before_script + - .ubuntu-common + script: + # Run the spread prepare section to build everything. + - yq -r '.prepare'