From 9e802e8dd4a0a467772b1d29ab355699710bd747 Mon Sep 17 00:00:00 2001 From: Romulo Leite Date: Tue, 7 May 2024 15:51:18 -0300 Subject: [PATCH] Add logic for building extra helm build This adds the build-extra-helm-charts script that looks for *.helm.build build files. And then runs the build command provided in the required BUILD_COMMAND field. It is also expected an OUTPUTS field on the helm.build with a pattern indicating the path to outputs of this build rlative to helm output Testplan: PASS - Run jenkins job to run custom helm app build Story: 2011098 Task: 50092 Change-Id: I23cb4a488af1eaf83cfe5c0216557b183744de08 Signed-off-by: Romulo Leite --- build-tools/build-extra-helm-charts.sh | 116 +++++++++++++++++++++++++ build-tools/build-helm-charts.sh | 9 +- 2 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 build-tools/build-extra-helm-charts.sh diff --git a/build-tools/build-extra-helm-charts.sh b/build-tools/build-extra-helm-charts.sh new file mode 100644 index 00000000..3d40287b --- /dev/null +++ b/build-tools/build-extra-helm-charts.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# +# Copyright (c) 2024 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +source ${MY_REPO}/build-tools/git-utils.sh || exit 1 +VERBOSE=false + +function usage { + cat >&2 <"extra-helm-charts.lst" || exit 1 + +} + +OPTS=$(getopt -o h,a:,A:,B:,r:,i:,l:,p: -l help,verbose -- "$@") +if [ $? -ne 0 ]; then + usage + exit 1 +fi + +eval set -- "${OPTS}" + +while true; do + case $1 in + --) + # End of getopt arguments + shift + break + ;; + --verbose) + VERBOSE=true + shift + ;; + -h | --help ) + usage + exit 1 + ;; + *) + usage + exit 1 + ;; + esac +done + +declare -a EXTRA_FILES +EXTRA_FILES=($(get_extra_files)) || exit 1 + +if [ ${#EXTRA_FILES[@]} -eq 0 ]; then + echo "WARNING: Could not find helm.build files" >&2 + exit 0 +fi + +if [ "$VERBOSE" = true ] ; then + echo" .helm.build files found: $EXTRA_FILES" +fi + +for extra_file in ${EXTRA_FILES}; do + perform_build $extra_file +done + +exit 0 + diff --git a/build-tools/build-helm-charts.sh b/build-tools/build-helm-charts.sh index ebe6599a..e17cc95d 100755 --- a/build-tools/build-helm-charts.sh +++ b/build-tools/build-helm-charts.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2018 Wind River Systems, Inc. +# Copyright (c) 2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -929,5 +929,10 @@ else build_application_tarball fi -exit 0 +export EXTRA_HELM_CHARTS="build-extra-helm-charts.sh" +echo "Running build extra helm charts script" +"${MY_REPO}/build-tools/$EXTRA_HELM_CHARTS" || exit 1 + + +exit 0