From c05051c5e6f45ee2429f365003ba7c804d6b4ffc Mon Sep 17 00:00:00 2001 From: Davlet Panech Date: Thu, 11 May 2023 14:04:13 -0400 Subject: [PATCH] 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 Change-Id: Idd57b4e0bbe0f231f83304a600496a48a71fba9f --- pipelines/monolithic.Jenkinsfile | 1 + scripts/create-latest-iso-symlinks.sh | 30 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 scripts/create-latest-iso-symlinks.sh diff --git a/pipelines/monolithic.Jenkinsfile b/pipelines/monolithic.Jenkinsfile index 2fd3592..0f4bf40 100644 --- a/pipelines/monolithic.Jenkinsfile +++ b/pipelines/monolithic.Jenkinsfile @@ -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') { diff --git a/scripts/create-latest-iso-symlinks.sh b/scripts/create-latest-iso-symlinks.sh new file mode 100755 index 0000000..2cb9b97 --- /dev/null +++ b/scripts/create-latest-iso-symlinks.sh @@ -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