Task 3: Adapt script to conform to Release 1 options
Add Jenkins builder and coverage options: - --run-jenkins-builder: Enable DEB package production mode - --package-output-dir: Output directory for .deb packages - --lts-version: LTS version for package metadata - --project: Project name (guez) - --build-number: Build number for package versioning - --build-tag: Build tag/identifier - --run-coverage: Enable lcov code coverage - --coverage-output-dir: Output directory for coverage reports Add MIGRATE_PIPELINE_ROOT handling with precedence: 1. Exported variable (Jenkinsfile) 2. .envrc file 3. Script location default Add validation for mutually exclusive options: - --run-jenkins-builder and --run-coverage cannot be used together Export all new variables for Docker container and pass to CMake. Co-authored-by: Copilot <223556619+Copilot@users.noreply.github.com>
This commit is contained in:
1 file changed
+123
@@ -33,6 +33,19 @@ Prebuilt Docker image usage:
|
||||
--cmake_build_flags FLAGS Extra CMake flags passed to the in-container configure
|
||||
(space-separated -D flags)
|
||||
|
||||
Package production options (DEB):
|
||||
--run-jenkins-builder Build the release DEB packages inside the container
|
||||
using the in-tree rpmbuild/make_rpm_ubuntu26.py
|
||||
--package-output-dir DIR Directory to mount for package output (default: ./packages-out)
|
||||
--lts-version VERSION LTS version for package (default: 1.0)
|
||||
--project NAME Project name for package (default: guez)
|
||||
--build-number NUM Build number for package (default: 1)
|
||||
--build-tag TAG Build tag for package (default: manual-build)
|
||||
|
||||
Coverage options (lcov):
|
||||
--run-coverage Build with -O0 --coverage, run ctest and collect lcov
|
||||
--coverage-output-dir DIR Directory to mount for coverage output (default: ./coverage-out)
|
||||
|
||||
Docker mount configuration:
|
||||
--docker-mount-root PATH Container-side mount root path (default: /repo)
|
||||
Changes where host directories are mounted in container
|
||||
@@ -45,11 +58,28 @@ Environment variable overrides:
|
||||
RUN_CTEST=ON|OFF
|
||||
TESTS_ONLY=ON|OFF
|
||||
USE_PREBUILT_IMAGE=ON|OFF
|
||||
RUN_JENKINS_BUILDER=ON|OFF
|
||||
PACKAGE_OUTPUT_DIR=<dir>
|
||||
LTS_VERSION=<version>
|
||||
PROJECT=<name>
|
||||
BUILD_NUMBER=<num>
|
||||
BUILD_TAG=<tag>
|
||||
RUN_COVERAGE=ON|OFF
|
||||
COVERAGE_OUTPUT_DIR=<dir>
|
||||
|
||||
MIGRATE_PIPELINE_ROOT resolution (highest precedence first):
|
||||
1. exported MIGRATE_PIPELINE_ROOT (e.g. from a Jenkinsfile)
|
||||
2. MIGRATE_PIPELINE_ROOT set by .envrc in this directory
|
||||
3. derived from the script location (the DLBO Qt6 repo root)
|
||||
|
||||
Examples:
|
||||
./new_docker_build_release2.sh --group1 --group3 --group5 --group6
|
||||
BUILD_GROUP1=ON BUILD_GROUP3=ON ./new_docker_build_release2.sh
|
||||
./new_docker_build_release2.sh --use-prebuilt-image --no-ctest
|
||||
./new_docker_build_release2.sh --group3 --run-jenkins-builder \
|
||||
--package-output-dir "${WORKSPACE}/rpms/guez/release2/"
|
||||
./new_docker_build_release2.sh --group3 --run-coverage \
|
||||
--coverage-output-dir "${WORKSPACE}/coverage/guez/release2/"
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
@@ -76,6 +106,46 @@ CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS:-}"
|
||||
DOCKER_MOUNT_ROOT="${DOCKER_MOUNT_ROOT:-/repo}"
|
||||
export DOCKER_MOUNT_ROOT
|
||||
|
||||
# Jenkins builder options for DEB package production
|
||||
RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}"
|
||||
PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR:-./packages-out}"
|
||||
LTS_VERSION="${LTS_VERSION:-1.0}"
|
||||
PROJECT="${PROJECT:-guez}"
|
||||
BUILD_NUMBER="${BUILD_NUMBER:-1}"
|
||||
BUILD_TAG="${BUILD_TAG:-manual-build}"
|
||||
|
||||
# Code coverage (lcov)
|
||||
RUN_COVERAGE="${RUN_COVERAGE:-OFF}"
|
||||
COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR:-./coverage-out}"
|
||||
|
||||
# Export variables for Docker container
|
||||
export BUILD_GROUP1 BUILD_GROUP3 BUILD_GROUP5 BUILD_GROUP6 RUN_CTEST TESTS_ONLY USE_PREBUILT_IMAGE
|
||||
export RUN_JENKINS_BUILDER PACKAGE_OUTPUT_DIR LTS_VERSION PROJECT BUILD_NUMBER BUILD_TAG
|
||||
export RUN_COVERAGE COVERAGE_OUTPUT_DIR
|
||||
|
||||
# MIGRATE_PIPELINE_ROOT resolution (highest precedence first):
|
||||
# 1. exported MIGRATE_PIPELINE_ROOT (e.g. from a Jenkinsfile)
|
||||
# 2. MIGRATE_PIPELINE_ROOT set by .envrc in this directory
|
||||
# 3. derived from the script location (the DLBO Qt6 repo root)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
MIGRATE_PIPELINE_ROOT_DEFAULT="${SCRIPT_DIR}"
|
||||
PIPELINE_ROOT_EXPORTED="${MIGRATE_PIPELINE_ROOT:-}"
|
||||
|
||||
if [[ -f ".envrc" ]]; then
|
||||
set -a
|
||||
source ".envrc"
|
||||
set +a
|
||||
fi
|
||||
|
||||
# An explicitly exported MIGRATE_PIPELINE_ROOT (Jenkinsfile) wins over .envrc
|
||||
if [[ -n "${PIPELINE_ROOT_EXPORTED}" ]]; then
|
||||
MIGRATE_PIPELINE_ROOT="${PIPELINE_ROOT_EXPORTED}"
|
||||
else
|
||||
MIGRATE_PIPELINE_ROOT="${MIGRATE_PIPELINE_ROOT:-${MIGRATE_PIPELINE_ROOT_DEFAULT}}"
|
||||
fi
|
||||
|
||||
export MIGRATE_PIPELINE_ROOT
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
@@ -139,6 +209,38 @@ while [[ $# -gt 0 ]]; do
|
||||
DOCKER_MOUNT_ROOT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--run-jenkins-builder)
|
||||
RUN_JENKINS_BUILDER="ON"
|
||||
shift
|
||||
;;
|
||||
--package-output-dir)
|
||||
PACKAGE_OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--lts-version)
|
||||
LTS_VERSION="$2"
|
||||
shift 2
|
||||
;;
|
||||
--project)
|
||||
PROJECT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--build-number)
|
||||
BUILD_NUMBER="$2"
|
||||
shift 2
|
||||
;;
|
||||
--build-tag)
|
||||
BUILD_TAG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--run-coverage)
|
||||
RUN_COVERAGE="ON"
|
||||
shift
|
||||
;;
|
||||
--coverage-output-dir)
|
||||
COVERAGE_OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
@@ -148,6 +250,11 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate mutually exclusive options
|
||||
if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]] && [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
die "Error: --run-jenkins-builder and --run-coverage are mutually exclusive"
|
||||
fi
|
||||
|
||||
require_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
die "Required command not found: $1"
|
||||
@@ -489,6 +596,14 @@ DOCKER_RUN_ARGS=(
|
||||
-e BUILD_GROUP6="${BUILD_GROUP6}"
|
||||
-e RUN_CTEST="${RUN_CTEST}"
|
||||
-e TESTS_ONLY="${TESTS_ONLY}"
|
||||
-e RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER}"
|
||||
-e PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR}"
|
||||
-e LTS_VERSION="${LTS_VERSION}"
|
||||
-e PROJECT="${PROJECT}"
|
||||
-e BUILD_NUMBER="${BUILD_NUMBER}"
|
||||
-e BUILD_TAG="${BUILD_TAG}"
|
||||
-e RUN_COVERAGE="${RUN_COVERAGE}"
|
||||
-e COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}"
|
||||
-v "${MIGRATE_PIPELINE_ROOT}:${DOCKER_MOUNT_ROOT}"
|
||||
-w "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
|
||||
)
|
||||
@@ -616,6 +731,14 @@ cmake -B "${BUILD_DIR}" \
|
||||
-DBUILD_GROUP3="${BUILD_GROUP3}" \
|
||||
-DBUILD_GROUP5="${BUILD_GROUP5}" \
|
||||
-DBUILD_GROUP6="${BUILD_GROUP6}" \
|
||||
-DRUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER}" \
|
||||
-DPACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR}" \
|
||||
-DLTS_VERSION="${LTS_VERSION}" \
|
||||
-DPROJECT="${PROJECT}" \
|
||||
-DBUILD_NUMBER="${BUILD_NUMBER}" \
|
||||
-DBUILD_TAG="${BUILD_TAG}" \
|
||||
-DRUN_COVERAGE="${RUN_COVERAGE}" \
|
||||
-DCOVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}" \
|
||||
'"${CMAKE_BUILD_FLAGS}"' \
|
||||
.
|
||||
|
||||
|
||||
Reference in new issue
Block a user