Create latest-iso-build symlink in archive area

This patch creates or updates the symlink "latest_iso_build" in the
archive and publish areas, immediately after the ISO build succeeds, but
before the other stages (docker images etc).

This allows external users to reference that path to download the latest
ISO, even if the overall build had failed due to docker image build
errors.

TESTS
================================================
Run a build where on of the docker images fails to compile
Make sure the new ISO build symlink gets created, even though the
overall build fails.

Story: 2010226
Task: 47978

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: Idd57b4e0bbe0f231f83304a600496a48a71fba9f
This commit is contained in:
Davlet Panech 2023-05-11 14:04:13 -04:00
parent e203534a0b
commit c05051c5e6
2 changed files with 31 additions and 0 deletions

View File

@ -313,6 +313,7 @@ or with paths relative to repo root:
steps { script {
runPart ("build-iso")
runPart ("publish-iso")
sh ("BUILD_STATUS=success ${Constants.SCRIPTS_DIR}/create-latest-iso-symlinks.sh")
} }
} // stage('ISO')
stage('IMAGES') {

View File

@ -0,0 +1,30 @@
#!/bin/bash
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
source $(dirname "$0")/lib/job_utils.sh
require_job_env BUILD_STATUS
load_build_env
if $DRY_RUN ; then
bail "DRY_RUN=true, bailing out..."
fi
set -x
if [[ "$BUILD_STATUS" == "success" ]] ; then
ln -sfn "$TIMESTAMP" "$BUILD_OUTPUT_ROOT/latest_iso_build"
if [[ -d "$PUBLISH_ROOT/$PUBLISH_TIMESTAMP" ]] ; then
if ! same_path "$BUILD_OUTPUT_ROOT" "$PUBLISH_ROOT" ; then
ln -sfn "$PUBLISH_TIMESTAMP" "$PUBLISH_ROOT/latest_iso_build"
fi
fi
fi