Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/jenkins-ci-rme/jenkins_builder_ubuntu26.sh
T
berrux-dev 2d1b12b5d8 Copy jenkins-ci-rme into the source tree and adapt it to this project
- Jenkinsfile: guez-only release pipeline; the prebuilt build image is
  built from the in-tree Dockerfile (via new_docker_build.sh
  --build-prebuilt-image) instead of a pre-pulled harbor image; the
  builder runs inside the container with the workspace mounted at
  /workspace; the post-publish cleanup stage was dropped so the DEBs
  stay under ${WORKSPACE}/rpms/... (the documented output location)
- jenkins_builder_ubuntu26.sh: uses the in-tree rpmbuild/
  make_rpm_ubuntu26.py instead of the outer-repo copy; same-file guard
  on the packages-out copy (host output dir == make_rpm output dir)
- jenkins_publisher_ubuntu26.sh: uploads rpms/${PROJECT}/${OS_VERSION}/
  directly - make_rpm_ubuntu26.py writes the DEBs there without a TDS
  subfolder
- release-16-10-2026.sh: local driver adapted to the current
  new_docker_build.sh interface (drops the no-longer-existing
  --use-prebuilt-image option, builds the image on demand, outputs to
  ${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/)
- make_rpm_ubuntu26.py: stage the new jenkins-ci-rme/ files (Jenkinsfile,
  builder, publisher) into the build-pipeline DEB (release-16-10-2026.sh
  was already listed)

Not copied (superseded): openSUSE builder/publisher, the old Dockerfile
recipes (replaced by the in-tree Dockerfile), Bitbucket notification
(jenkins_notifier.sh is not part of this project)
2026-10-14 16:28:03 +02:00

95 lines
4.1 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Build the LTS DEB packages for the Qt6-migrated legatus release
# (validation scope: TetraIF, Z, Lts/Common + Lts/Proxies/TrainingAreaBase)
# for Ubuntu 26.04.
#
# Runs inside the prebuilt build container (built from the in-tree
# Dockerfile) with the pipeline workspace mounted at /workspace.
# Packaging is done by the IN-TREE rpmbuild copy
# (qt-migration-legatus/qt6-after/qt6-migrated-legatus/rpmbuild/), so the
# release flow needs no files outside the source tree.
#
# Required environment (set by the Jenkinsfile or `docker run -e ...`):
# PROJECT LTS flavor: guez
# OS_VERSION Ubuntu version, e.g. 26.04
# LTS_VERSION Major.minor LTS version, e.g. 1.0
# GUEZ_MODE ON | OFF — cmake -DGUEZ_MODE
# WORKSPACE Container workspace path (/workspace)
# PROJECT_BASE_DIR Staging root inside the container (/workspace)
# BUILD_NUMBER Build number (used as release in the DEB version)
# BUILD_TAG Build tag
#
# IMPORTANT: Source files under git management must NEVER be deleted.
# Only the temporary staging directory (deb_stage) is removed.
set -eo pipefail
: "${PROJECT:?PROJECT must be set}"
: "${OS_VERSION:?OS_VERSION must be set}"
: "${LTS_VERSION:?LTS_VERSION must be set}"
: "${GUEZ_MODE:?GUEZ_MODE must be set}"
: "${WORKSPACE:?WORKSPACE must be set}"
: "${PROJECT_BASE_DIR:?PROJECT_BASE_DIR must be set}"
echo "Building LTS ${LTS_VERSION}-${BUILD_NUMBER:-?} DEB for project '${PROJECT}' (Ubuntu ${OS_VERSION})."
echo "PROJECT_BASE_DIR=${PROJECT_BASE_DIR}"
export RTI_LICENSE_FILE="${WORKSPACE}/rti_license.dat"
# Stage workspace as a clean copy under PROJECT_BASE_DIR/deb_stage.
# Only the staging subdirectory is removed — never the workspace itself,
# which contains git-managed source files that must not be deleted.
STAGE_DIR="${PROJECT_BASE_DIR}/deb_stage"
rm -rf "${STAGE_DIR}"
mkdir -p "${STAGE_DIR}"
tar --exclude='./rpms' --exclude='./.git' --exclude='./build' \
--exclude='./deb_build_tmp' --exclude='./deb_stage' --exclude='./packages-out' \
-cf - -C "${WORKSPACE}" . | tar -xf - -C "${STAGE_DIR}"
export VERSION_DATE
VERSION_DATE=$(date +%Y-%m-%d)
# Real CMake project root inside the staged tree (the in-tree source)
SOURCE_DIR="${STAGE_DIR}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
if [ ! -f "${SOURCE_DIR}/CMakeLists.txt" ] || [ ! -f "${SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26.py" ]; then
echo "ERROR: staged source incomplete under ${SOURCE_DIR} (CMakeLists.txt or rpmbuild/make_rpm_ubuntu26.py missing)" >&2
exit 1
fi
# Output is isolated per OS version so parallel OS builds of the same
# project never collide
cd "${SOURCE_DIR}/rpmbuild"
python3 make_rpm_ubuntu26.py -c LTS \
--project_name "${PROJECT}" \
--version "${LTS_VERSION}" \
--output_dir "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/" \
--source_dir "${SOURCE_DIR}" \
--cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DRELEASE_BUILD=ON" \
--build_number "${BUILD_NUMBER:-1}" \
--release_scope
# Copy produced DEB packages to the packages-out mount (host:
# ${PACKAGE_OUTPUT_DIR}, container: /workspace/packages-out) so they are
# available on the host after the container exits.
# make_rpm already writes to ${WORKSPACE}/rpms/... (the host workspace
# mount), so when the host's PACKAGE_OUTPUT_DIR is that same directory the
# packages are already in place - skip copying onto themselves.
PACKAGE_OUT_DIR=/workspace/packages-out
mkdir -p "${PACKAGE_OUT_DIR}"
shopt -s nullglob
for deb in "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/"*.deb; do
base="$(basename "${deb}")"
if [[ -e "${PACKAGE_OUT_DIR}/${base}" ]] &&
[[ "$(stat -c '%d:%i' "${deb}")" == "$(stat -c '%d:%i' "${PACKAGE_OUT_DIR}/${base}")" ]]; then
continue
fi
cp -f "${deb}" "${PACKAGE_OUT_DIR}/"
done
shopt -u nullglob
echo "DEB packages produced for '${PROJECT}' (Ubuntu ${OS_VERSION}):"
ls -lhR "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/"
echo "DEB packages copied to ${PACKAGE_OUT_DIR}:"
ls -lh "${PACKAGE_OUT_DIR}/"