stx-debian: override stx-debian tag prefix

Currently both the main and openstack Jenkins builds assign the same tag
pattern to the generated docker images, including the base image.
Consequently if you pull stx-debian:master-stable-latest, you might get
either the main image or the openstack image, depending on time of day.
Yet their apt configurations point to different build repositories.

Solution: add a build.conf option to override the tag prefix, eg from
"master" to "master-openstack": BASE_IMAGE_TAG_PREFIX.

TESTS
===================================
Build the base image and a derived image in Jenkins with and without the
new build.conf option.

Story: 2010055
Task: 52813

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: Ibc08928c5302e4608ace05d2f37a5a73b7f0d6b5
This commit is contained in:
Davlet Panech
2025-09-16 10:48:28 -04:00
parent 98a3651e6a
commit 648dc95e85
3 changed files with 18 additions and 3 deletions

View File

@@ -30,8 +30,12 @@ if [[ -z "$BUILD_BRANCH_FOR_IMAGE_TAG" ]] ; then
BUILD_BRANCH_FOR_IMAGE_TAG="${BUILD_BRANCH/#r\//rc-}"
fi
base_image_tag="${BUILD_BRANCH_FOR_IMAGE_TAG=}-${BUILD_STREAM}-$TIMESTAMP"
base_image_latest_tag="${BUILD_BRANCH_FOR_IMAGE_TAG=}-${BUILD_STREAM}-latest"
if [[ -z "$BASE_IMAGE_TAG_PREFIX" ]] ; then
BASE_IMAGE_TAG_PREFIX="$BUILD_BRANCH_FOR_IMAGE_TAG"
fi
base_image_tag="${BASE_IMAGE_TAG_PREFIX}-${BUILD_STREAM}-$TIMESTAMP"
base_image_latest_tag="${BASE_IMAGE_TAG_PREFIX}-${BUILD_STREAM}-latest"
declare -a cmd=(
"./build-stx-base.sh"

View File

@@ -30,6 +30,10 @@ if [[ -z "$BUILD_BRANCH_FOR_IMAGE_TAG" ]] ; then
BUILD_BRANCH_FOR_IMAGE_TAG="${BUILD_BRANCH/#r\//rc-}"
fi
if [[ -z "$BASE_IMAGE_TAG_PREFIX" ]] ; then
BASE_IMAGE_TAG_PREFIX="$BUILD_BRANCH_FOR_IMAGE_TAG"
fi
HOST_WORKSPACE="$BUILD_HOME/workspace"
wheels_file="std/build-wheels-$DOCKER_BASE_OS-$BUILD_STREAM/stx-$DOCKER_BASE_OS-$BUILD_STREAM-wheels.tar"
@@ -52,7 +56,7 @@ declare -a cmd=(
if [[ -n "$DOCKER_IMAGE_BASE" ]] ; then
cmd+=("--base=$DOCKER_IMAGE_BASE")
elif $BUILD_DOCKER_BASE_IMAGE ; then
base_image_tag="${BUILD_BRANCH_FOR_IMAGE_TAG}-${BUILD_STREAM}-$TIMESTAMP"
base_image_tag="${BASE_IMAGE_TAG_PREFIX}-${BUILD_STREAM}-$TIMESTAMP"
docker_base_image="$DOCKER_REGISTRY_ORG/stx-$DOCKER_BASE_OS:$base_image_tag"
if [[ -n "$DOCKER_REGISTRY" ]] ; then
docker_base_image="$DOCKER_REGISTRY/$docker_base_image"

View File

@@ -26,6 +26,13 @@ BUILD_BRANCH="master"
# rc-stx.8.0
BUILD_BRANCH_FOR_IMAGE_TAG="${BUILD_BRANCH/#r\//rc-}"
# Prefix for the base image tag, ie: stx-debian:PREFIX-stable-TIMESTAMP
# This applies only to the base image, ie stx-debian
# Example for openstack builds:
# master-openstack => stx-debian:master-openstack-debian-TIMESTAMP
# If empty we will use BUILD_BRANCH_FOR_IMAGE_TAG.
BASE_IMAGE_TAG_PREFIX=
# Project name, must be unique for a given BUILD_USER
PROJECT_ID="dpanech-debian"