Add --ignore flag to build-helm-charts.sh file
Recently a review was merged changing the cp command to rsync, so the helm-toolkit Helm-chart would not be added to the final application tarball. https://review.opendev.org/c/starlingx/root/+/927047 This change is a follow-up to that bug-fix. The objective here is to remove the hard coded helm-toolkit name from the rsync, and replace it with a variable containing the contents of a new flag (--ignore). This flag is to list all Helm-charts that are not to be included in the final application-tarball. Test-Plan: PASS - Application tarball built without the charts defined by the flag PASS - Application tarball is built if the flag is not used PASS - STX-Openstack upload, apply, remove, delete and re-upload Closes-Bug: 2077759 Change-Id: I3d04479c8fad108e8777368d28acee84b9f8f7a9 Signed-off-by: Daniel Caires <DanielMarques.Caires@windriver.com>
This commit is contained in:
parent
93d6fe12d5
commit
e8c3dca8d3
@ -23,6 +23,7 @@ declare -a IMAGE_RECORDS
|
||||
declare -a PATCH_DEPENDENCIES
|
||||
declare -a APP_PACKAGES
|
||||
declare -a CHART_PACKAGE_FILES
|
||||
declare -a IGNORE_CHARTS
|
||||
# PYTHON_2_OR_3: initialized below
|
||||
|
||||
VERBOSE=false
|
||||
@ -36,6 +37,7 @@ $(basename $0) [--os <os>] [-a, --app <app-name>]
|
||||
[-A, --app-version-file /path/to/$APP_VERSION_BASE]
|
||||
[-B, --app-version <version>]
|
||||
[--package <package-name>] [-i, --image-record <image-record>] [--label <label>]
|
||||
[--ignore <chart-name>]
|
||||
[-p, --patch-dependency <patch-dependency>] [ --verbose ]
|
||||
Options:
|
||||
--os:
|
||||
@ -71,6 +73,10 @@ Options:
|
||||
Specify the label of the application tarball. The label
|
||||
will be appended to the version string in tarball name.
|
||||
|
||||
--ignore IGNORE_CHARTS,... :
|
||||
Specify the Helm chart file name pattern(s) to be excluded
|
||||
from the final application tarball.
|
||||
|
||||
-p, --patch-dependency DEPENDENCY,... :
|
||||
Specify the patch dependency of the application tarball,
|
||||
comma-separated
|
||||
@ -654,7 +660,7 @@ function get_app_version {
|
||||
}
|
||||
|
||||
# TODO(awang): remove the deprecated image-file option
|
||||
OPTS=$(getopt -o h,a:,A:,B:,i:,l:,p: -l help,os:,app:,app-version-file:,app-version:,package:,image-record:,image-file:,label:,patch-dependency:,verbose -- "$@")
|
||||
OPTS=$(getopt -o h,a:,A:,B:,i:,l:,p: -l help,os:,app:,app-version-file:,app-version:,package:,image-record:,image-file:,label:,ignore:,patch-dependency:,verbose -- "$@")
|
||||
if [ $? -ne 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
@ -698,6 +704,11 @@ while true; do
|
||||
LABEL=$2
|
||||
shift 2
|
||||
;;
|
||||
--ignore)
|
||||
# Read comma-separated values into array
|
||||
IGNORE_CHARTS+=(${2//,/ })
|
||||
shift 2
|
||||
;;
|
||||
-p | --patch-dependency)
|
||||
# Read comma-separated values into array
|
||||
PATCH_DEPENDENCIES+=(${2//,/ })
|
||||
@ -851,8 +862,16 @@ if [ ! -d "usr/lib/fluxcd" ] || [ ! -d "usr/lib/helm" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Stage all the charts
|
||||
rsync -a usr/lib/helm/ staging/charts/ --exclude=helm-toolkit-*
|
||||
# Transform array into the format expected by rsync
|
||||
declare -a IGNORE_CHARTS_ARGS
|
||||
if [ ${#IGNORE_CHARTS[@]} -ne 0 ]; then
|
||||
for chart in "${IGNORE_CHARTS[@]}"; do
|
||||
IGNORE_CHARTS_ARGS+=("--exclude=${chart}")
|
||||
done
|
||||
fi
|
||||
|
||||
# Stage the charts
|
||||
rsync -a usr/lib/helm/ staging/charts/ "${IGNORE_CHARTS_ARGS[@]}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to copy the charts from ${BUILD_OUTPUT_PATH}/usr/lib/helm to ${BUILD_OUTPUT_PATH}/staging/charts" >&2
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user