From 28c107a0e5d6175ae088b2aa5302a30c8a81c908 Mon Sep 17 00:00:00 2001 From: LAURENL <45975633+lauren-li@users.noreply.github.com> Date: Tue, 1 Apr 2025 05:07:12 +0200 Subject: [PATCH 1/4] Initial update for dbbBuild.sh to handle deletion-only case Signed-off-by: LAURENL <45975633+lauren-li@users.noreply.github.com> --- Templates/Common-Backend-Scripts/dbbBuild.sh | 44 +++++++++++--------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/Templates/Common-Backend-Scripts/dbbBuild.sh b/Templates/Common-Backend-Scripts/dbbBuild.sh index 86445150..6fbec4cd 100755 --- a/Templates/Common-Backend-Scripts/dbbBuild.sh +++ b/Templates/Common-Backend-Scripts/dbbBuild.sh @@ -168,6 +168,11 @@ nestedApplicationFolder="" # Flag to understand a nested repository LastBuildLog="" buildlistsize=0 +# TODO: new +totalLogListSize=0 +buildListFile="" +deletedFilesListFile="" +# TODO: end new DBBLogger="" zAppBuildVerbose="" @@ -503,33 +508,34 @@ if [ $rc -eq 0 ]; then ## Except for the reset mode, check for "nothing to build" condition and throw an error to stop pipeline if [ "$Type" != "--reset" ]; then - - # Locate the most recent Build Log Directory within outDir. The Build Log Directories are Time Stamped. - # Therefore, the last directory entry will be the most recent Build Log. The directory will always be - # be created by DBB, but "buildList.txt" may not. If not created, array will will be blank. - array=$(find ${outDir} -name "buildList.txt") - for log in ${array[@]}; do - LastBuildLog=${log} - echo $PGM": [INFO] LastBuildLog = ${LastBuildLog}" + + # Locate buildList and deletedFilesList in Build Log Directory within outDir, and group them in logListArray + buildListFile="${outDir}/buildList.txt" + deletedFilesListFile="${outDir}/deletedFilesList.txt" + logListArray=(${buildListFile} ${deletedFilesListFile}) + + # For each list in logListArray, if found in the last Build Log Directory, get its size (character count), then + # increase logListSize by that amount. + for list in ${logListArray}; do + if [ -f ${list} ]; then + # wc -c will return the two values; Character Count and Log File Path. Parse out the Character Count. + set $(wc -c <${list}) + echo ?${list} size: ?$1 + logListSize=${totalLogListSize}+$1 + echo ?totalLogListSize: ?${totalLogListSize} + fi done - # If "buildList.txt" was found in the last Build Log Directory, determine the character count. - # wc -c will return the two values; Character Count and Log File Path. Parse out the Character Count. - if [ -z ${LastBuildLog} ]; then - buildlistsize=0 - else - set $(wc -c <${LastBuildLog}) - buildlistsize=$1 - fi - - if [ $buildlistsize = 0 ]; then + # Error/warning if both build and file list have 0 character count (i.e. are empty) + if [ ${totalLogListSize} ] = 0; then rc=4 - ERRMSG=$PGM": [WARNING] DBB Build Error. No source changes detected. rc="$rc + ERRMSG=$PGM": [WARNING] DBB Build Error. No files on build list or deleted files list. rc="$rc echo $ERRMSG else ERRMSG=$PGM": [INFO] DBB Build Complete. rc="$rc echo $ERRMSG fi + else ERRMSG=$PGM": [INFO] DBB Reset Complete. rc="$rc echo $ERRMSG From 8c717c3453b781f70668167acbbfe65e5b2463a8 Mon Sep 17 00:00:00 2001 From: LAURENL <45975633+lauren-li@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:33:05 +0200 Subject: [PATCH 2/4] Fix punctuation and variable names Signed-off-by: LAURENL <45975633+lauren-li@users.noreply.github.com> --- Templates/Common-Backend-Scripts/dbbBuild.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Templates/Common-Backend-Scripts/dbbBuild.sh b/Templates/Common-Backend-Scripts/dbbBuild.sh index 6fbec4cd..761cc3d2 100755 --- a/Templates/Common-Backend-Scripts/dbbBuild.sh +++ b/Templates/Common-Backend-Scripts/dbbBuild.sh @@ -128,7 +128,7 @@ Help() { # Build Type Customization # Configuration file leveraged by the backend scripts # Either an absolute path or a relative path to the current working directory -SCRIPT_HOME="`dirname "$0"`" +SCRIPT_HOME="/u/gitlab/dbb/Templates/Common-Backend-Scripts" pipelineConfiguration="${SCRIPT_HOME}/pipelineBackend.config" buildUtilities="${SCRIPT_HOME}/utilities/dbbBuildUtils.sh" # Customization - End @@ -390,7 +390,7 @@ validateOptions() { fi fi - BuildGroovy="${zAppBuild}/build.groovy" + BuildGroovy="/var/dbb/dbb-zappbuild_300/build.groovy" if [ ! -f "${BuildGroovy}" ]; then rc=8 @@ -516,18 +516,22 @@ if [ $rc -eq 0 ]; then # For each list in logListArray, if found in the last Build Log Directory, get its size (character count), then # increase logListSize by that amount. - for list in ${logListArray}; do + for list in ${logListArray[@]}; do + echo "Print: "${list} if [ -f ${list} ]; then + echo "Found: "${list} # wc -c will return the two values; Character Count and Log File Path. Parse out the Character Count. set $(wc -c <${list}) - echo ?${list} size: ?$1 - logListSize=${totalLogListSize}+$1 - echo ?totalLogListSize: ?${totalLogListSize} + echo "${list} size: "$1 + totalLogListSize=$((${totalLogListSize}+$1)) + echo "totalLogListSize: "${totalLogListSize} + else + echo "Not found: "${list} fi done # Error/warning if both build and file list have 0 character count (i.e. are empty) - if [ ${totalLogListSize} ] = 0; then + if [ ${totalLogListSize} = 0 ]; then rc=4 ERRMSG=$PGM": [WARNING] DBB Build Error. No files on build list or deleted files list. rc="$rc echo $ERRMSG From 51a47c17bd6372824d6545127ed0d9fdc8fee11d Mon Sep 17 00:00:00 2001 From: Lauren Li <45975633+lauren-li@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:01:29 +1000 Subject: [PATCH 3/4] dbbBuild.sh minor script cleanup Signed-off-by: Lauren Li <45975633+lauren-li@users.noreply.github.com> --- Templates/Common-Backend-Scripts/dbbBuild.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Templates/Common-Backend-Scripts/dbbBuild.sh b/Templates/Common-Backend-Scripts/dbbBuild.sh index 761cc3d2..5629b3ae 100755 --- a/Templates/Common-Backend-Scripts/dbbBuild.sh +++ b/Templates/Common-Backend-Scripts/dbbBuild.sh @@ -128,7 +128,7 @@ Help() { # Build Type Customization # Configuration file leveraged by the backend scripts # Either an absolute path or a relative path to the current working directory -SCRIPT_HOME="/u/gitlab/dbb/Templates/Common-Backend-Scripts" +SCRIPT_HOME="`dirname "$0"`" pipelineConfiguration="${SCRIPT_HOME}/pipelineBackend.config" buildUtilities="${SCRIPT_HOME}/utilities/dbbBuildUtils.sh" # Customization - End @@ -166,13 +166,10 @@ propOverrides="" # Override of default build parameters for zAppBuild outDir="" # Computed output directory to store build protocols nestedApplicationFolder="" # Flag to understand a nested repository -LastBuildLog="" -buildlistsize=0 -# TODO: new +# Local variables for checking the contents of buildList and deletedFilesList totalLogListSize=0 buildListFile="" deletedFilesListFile="" -# TODO: end new DBBLogger="" zAppBuildVerbose="" @@ -390,7 +387,7 @@ validateOptions() { fi fi - BuildGroovy="/var/dbb/dbb-zappbuild_300/build.groovy" + BuildGroovy="${zAppBuild}/build.groovy" if [ ! -f "${BuildGroovy}" ]; then rc=8 @@ -517,16 +514,10 @@ if [ $rc -eq 0 ]; then # For each list in logListArray, if found in the last Build Log Directory, get its size (character count), then # increase logListSize by that amount. for list in ${logListArray[@]}; do - echo "Print: "${list} if [ -f ${list} ]; then - echo "Found: "${list} # wc -c will return the two values; Character Count and Log File Path. Parse out the Character Count. set $(wc -c <${list}) - echo "${list} size: "$1 totalLogListSize=$((${totalLogListSize}+$1)) - echo "totalLogListSize: "${totalLogListSize} - else - echo "Not found: "${list} fi done From 65edfa8fdfcc2166cc14037389238287e0f0cf78 Mon Sep 17 00:00:00 2001 From: Lauren Li <45975633+lauren-li@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:21:39 +1000 Subject: [PATCH 4/4] Additional cleanup and error message refinement Signed-off-by: Lauren Li <45975633+lauren-li@users.noreply.github.com> --- Templates/Common-Backend-Scripts/dbbBuild.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Templates/Common-Backend-Scripts/dbbBuild.sh b/Templates/Common-Backend-Scripts/dbbBuild.sh index 5629b3ae..7001e8f5 100755 --- a/Templates/Common-Backend-Scripts/dbbBuild.sh +++ b/Templates/Common-Backend-Scripts/dbbBuild.sh @@ -524,13 +524,12 @@ if [ $rc -eq 0 ]; then # Error/warning if both build and file list have 0 character count (i.e. are empty) if [ ${totalLogListSize} = 0 ]; then rc=4 - ERRMSG=$PGM": [WARNING] DBB Build Error. No files on build list or deleted files list. rc="$rc + ERRMSG=$PGM": [WARNING] DBB Build Error. No source changes detected. rc="$rc echo $ERRMSG else ERRMSG=$PGM": [INFO] DBB Build Complete. rc="$rc echo $ERRMSG fi - else ERRMSG=$PGM": [INFO] DBB Reset Complete. rc="$rc echo $ERRMSG