From b9e3fc0964b1be0ada79d41cc4249272e076c640 Mon Sep 17 00:00:00 2001 From: jbarboza Date: Wed, 22 Jan 2025 17:01:34 -0300 Subject: [PATCH] Fixed third-party packages bug With the introduction of the custom manifests update [1], a new bug was found when third-party packages were added to the project scope. This new feature was ignoring all custom manifests that were not part of the official build, causing errors to happen when such packages were used [1] https://review.opendev.org/c/starlingx/root/+/938481 Test Plan: - PASS: Build package with specific custom manifest directory (/custom-manifests) - PASS: Execute build-helm-charts.sh - PASS: Compare diffs between official and merged manifests - PASS: Apply generated tarball - PASS: Execute any commands related to the third-party package Closes-Bug: 2095498 Change-Id: Id212e7dd63d7a6013f572a8c217fde6f1b663f9c Signed-off-by: jbarboza (cherry picked from commit 3618d3046a5f1f2d897570754b465413b1920b5e) --- build-tools/build-helm-charts.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/build-tools/build-helm-charts.sh b/build-tools/build-helm-charts.sh index 35c5a5be..d961c37e 100755 --- a/build-tools/build-helm-charts.sh +++ b/build-tools/build-helm-charts.sh @@ -305,15 +305,25 @@ function build_application_tarball_armada { function compare_custom_manifests { MANIFEST_LIST=$1 for manifest in ${MANIFEST_LIST}; do + + if [ ! -s usr/lib/fluxcd/${manifest} ]; then + cp -R usr/lib/fluxcd/custom-manifests/${manifest} usr/lib/fluxcd/${manifest} + continue + fi + + if [ -f usr/lib/fluxcd/custom-manifests/${manifest} ]; then + ${PYTHON_2_OR_3} $BUILD_HELM_CHARTS_DIR/merge_manifests.py usr/lib/fluxcd/${manifest} usr/lib/fluxcd/custom-manifests/${manifest} + continue + fi + MAIN_MANIFESTS=$(ls usr/lib/fluxcd/${manifest}) CUSTOM_MANIFESTS=$(ls usr/lib/fluxcd/custom-manifests/${manifest}) for manifest_file in ${MAIN_MANIFESTS}; do - if [ ! -f usr/lib/fluxcd/custom-manifests/${manifest}/${manifest_file} ]; then - echo "Warning: missing ${manifest_file} in custom manifests" - else - ${PYTHON_2_OR_3} $BUILD_HELM_CHARTS_DIR/merge_manifests.py usr/lib/fluxcd/${manifest}/${manifest_file} usr/lib/fluxcd/custom-manifests/${manifest}/${manifest_file} - fi + ${PYTHON_2_OR_3} \ + $BUILD_HELM_CHARTS_DIR/merge_manifests.py \ + usr/lib/fluxcd/${manifest}/${manifest_file} \ + usr/lib/fluxcd/custom-manifests/${manifest}/${manifest_file} done done }