jenkins-pipelines/scripts/publish-helm-charts.sh
Romulo Leite cdf247f4d6 Copy extra helm build outputs to export
Following the work on [1] we need to allow the
outputs generated by the build command on extra
helm build to be placed on export.

Testplan:
PASS - Run jenkins job to run custom helm app
       build
PASS - 	Notice the outputs on /export directory

Story: 2011098
Task: 50092

[1] https://review.opendev.org/c/starlingx/root/+/918475

Change-Id: I6483bcf39566fefe980482ef82c942908f1e14f6
Signed-off-by: Romulo Leite <romulo.leite@windriver.com>
2024-05-16 15:05:34 -03:00

46 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
source $(dirname "$0")/lib/job_utils.sh
load_build_env
$DRY_RUN && bail "DRY_RUN not supported, bailing out" || :
helm_dir="$BUILD_OUTPUT_HOME/$WORKSPACE_ROOT_SUBDIR/helm-charts"
src_dir="$BUILD_OUTPUT_HOME/$WORKSPACE_ROOT_SUBDIR/helm-charts/stx"
dst_dir="$PUBLISH_DIR/outputs/helm-charts"
extra_lst="$src_dir/extra-helm-charts.lst"
files="$(
if [[ -d "$src_dir" ]] ; then
find "$src_dir" -mindepth 1 -maxdepth 1 -xtype f -name "*.tgz" || exit 1
fi
)"
if [[ -n "$files" ]] ; then
notice "copying helm charts to $dst_dir"
mkdir -p "$dst_dir"
echo "$files" | xargs -r \cp --force --no-dereference --preserve=mode,timestamps,links -t "$dst_dir"
fi
#Check for oututs of extra helm charts build
if [[ -f "$extra_lst" ]] ; then
while IFS= read -r "file"; do
file_path="$helm_dir/$file"
if [[ -f "$file_path" ]] ; then
echo "copying $file to $dst_dir"
\cp --force --no-dereference --preserve=mode,timestamps,links -t "$dst_dir" "$file_path"
else
echo "$file not found"
fi
done < "$extra_lst"
else
echo "No files found from extra helm build "
fi