From 5253ec0fc3b8212ec93575a26465581c88cdaf99 Mon Sep 17 00:00:00 2001 From: Terry Brady Date: Tue, 25 Jul 2023 15:53:34 -0700 Subject: [PATCH] build email option --- bin/fresh_build.sh | 10 +++++++--- fresh_build.md | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bin/fresh_build.sh b/bin/fresh_build.sh index 09d4613..4fb21de 100755 --- a/bin/fresh_build.sh +++ b/bin/fresh_build.sh @@ -437,10 +437,12 @@ post_summary_report() { date >> $LOGSUM STATUS=`get_jobstat` SUBJ="${STATUS}: Merritt Daily Build $MD_BRANCH - $BC_LABEL - ${MAVEN_PROFILE}" - if [ "$JENKINS_HOME" == "" ] + if [[ "$JENKINS_HOME" == "" ]] && [[ $EMAIL > 0 ]] then DIST=`get_ssm_value_by_name 'batch/email'` cat $LOGSUM | mail -a $LOGSCAN -a $LOGSCANFIXED -s "$SUBJ" ${DIST//,/} + else + cat $LOGSUM fi echo $SUBJ } @@ -457,6 +459,7 @@ usage() { echo " default: /apps/dpr2/merritt-workspace/daily-builds/[merritt-docker-branch].[build-config-profile-name]/merritt-docker" echo " if path contains 'merritt-workspace/daily-builds', the directory will be recreated" echo " -j workidir, Jenkins working directory in which build will run. Jenkins will not create a 'merritt-docker' directory for clone" + echo " -e; email build results" echo "" } @@ -487,9 +490,9 @@ BC_LABEL=main MAVEN_PROFILE="-P uc3" TAG_PUB=testall CHECK_REPO_TAG= -HELP=0 +EMAIL=0 -while getopts "B:C:m:p:t:w:j:h" flag +while getopts "B:C:m:p:t:w:j:he" flag do case "${flag}" in B) MD_BRANCH=${OPTARG};; @@ -509,6 +512,7 @@ do j) WKDIR=${OPTARG} WKDIR_PAR=$WKDIR ;; + e) EMAIL=1;; h) usage exit ;; diff --git a/fresh_build.md b/fresh_build.md index e48a134..bf4297f 100755 --- a/fresh_build.md +++ b/fresh_build.md @@ -18,9 +18,12 @@ fresh_build.sh default: /apps/dpr2/merritt-workspace/daily-builds/[merritt-docker-branch].[build-config-profile-name]/merritt-docker if path contains 'merritt-workspace/daily-builds', the directory will be recreated -j workidir, Jenkins working directory in which build will run. Jenkins will not create a 'merritt-docker' directory for clone - + -e; email build results ``` +## Jeninks pipeline +- [Jenkinsfile](Jenkinsfile) + ## Dependencies required for the script to run - ECR Access - docker and docker-compose @@ -31,9 +34,9 @@ fresh_build.sh ## Runtime Options - Daily build/scan ALL Merritt docker images - - `fresh_build.sh` + - `fresh_build.sh -e` - same as the following - - `fresh_build.sh -B main -C main -m uc3` + - `fresh_build.sh -B main -C main -m uc3 -e` - Daily build/scan ALL Merritt docker images defined in branch "foo" - `fresh_build.sh -B foo` - Daily build/scan ALL Merritt docker images defined in build config "bar" residing in merritt-docker branch "foo"