Skip to content

Commit

Permalink
build email option
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jul 25, 2023
1 parent 4bf12b6 commit 5253ec0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 7 additions & 3 deletions bin/fresh_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 ""
}

Expand Down Expand Up @@ -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};;
Expand All @@ -509,6 +512,7 @@ do
j) WKDIR=${OPTARG}
WKDIR_PAR=$WKDIR
;;
e) EMAIL=1;;
h) usage
exit
;;
Expand Down
9 changes: 6 additions & 3 deletions fresh_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 5253ec0

Please sign in to comment.