From 8ca08c0b4b37d3b9ba1c1fdb7837b089a97e2ced Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Fri, 14 Mar 2025 14:37:02 -0400 Subject: [PATCH] script/buildcontainer-setup: set JENKINS_HOME while building image Set the JENKINS_HOME environment variable while building the builder image. This is needed because parts of scripts like run-make.sh and install-deps.sh key off of this variable. Since we want to be able to use the build container to build, run "make check" and the like, we want that environment to be as similar to the jenkins CI environment as we can make it. Signed-off-by: John Mulligan (cherry picked from commit f026709b1f7e323908eaf8f4582ae1bd1ed7a323) (cherry picked from commit 35a848da909543e7036185cf6e78b6693453e8ac) --- src/script/buildcontainer-setup.sh | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/script/buildcontainer-setup.sh diff --git a/src/script/buildcontainer-setup.sh b/src/script/buildcontainer-setup.sh new file mode 100644 index 00000000000..f17b435322a --- /dev/null +++ b/src/script/buildcontainer-setup.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +install_container_deps() { + source ./src/script/run-make.sh + # set JENKINS_HOME in order to have the build container look as much + # like an existing jenkins build environment as possible + export JENKINS_HOME=/ceph + prepare +} + +dnf_clean() { + if [ "${CLEAN_DNF}" != no ]; then + dnf clean all + rm -rf /var/cache/dnf/* + fi +} + +set -e +export LOCALE=C +cd ${CEPH_CTR_SRC} + +# If DISTRO_KIND is not already set, derive it from the container's os-release. +if [ -z "$DISTRO_KIND" ]; then + . /etc/os-release + DISTRO_KIND="${ID}:${VERSION_ID}" +fi + +# Execute a container setup process, installing the packges needed to build +# ceph for the given ~ pair. Some distros need extra +# tools in the container image vs. vm hosts or extra tools needed to build +# packages etc. +case "${CEPH_BASE_BRANCH}~${DISTRO_KIND}" in + *~*centos*8) + dnf install -y java-1.8.0-openjdk-headless /usr/bin/{rpmbuild,wget,curl} + install_container_deps + dnf_clean + ;; + # EL-ish, 9+ + *~*centos*|*~fedora*|*~rocky*|*~alma*) + dnf install -y /usr/bin/{rpmbuild,wget,curl} + install_container_deps + dnf_clean + ;; + *~*ubuntu*|*~*debian*) + apt-get update + apt-get install -y wget reprepro curl software-properties-common lksctp-tools libsctp-dev protobuf-compiler ragel libc-ares-dev + install_container_deps + ;; + *) + echo "Unknown action, branch or build: ${CEPH_BASE_BRANCH}~${DISTRO_KIND}" >&2 + exit 2 + ;; +esac \ No newline at end of file -- 2.39.5