Skip to content

Commit

Permalink
tidy logic
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jul 25, 2023
1 parent 23103ed commit 7d9d5f0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ dependencies.txt
mrt-services/it.txt
mrt-services/war.txt
build-output/*.txt
build-output/*.jar
build-output/*.war
build-output/artifacts/
build.content.txt
51 changes: 24 additions & 27 deletions bin/fresh_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@ create_working_dir() {
fi
cd $WKDIR_PAR

if [[ -f $WKDIR/build-output/*.war ]]
then
rm $WKDIR/build-output/*.war
fi

if [[ -f $WKDIR/build-output/*.jar ]]
then
rm $WKDIR/build-output/*.jar
fi
rm -rf $ARTIFACTS build-output/*.txt
}

get_jobstat(){
Expand Down Expand Up @@ -323,37 +315,37 @@ build_maven_artifacts() {
then
if check_maven_profile 'store'
then
cp $WKDIR/mrt-services/store/mrt-store/store-war/target/mrt-storewar-1.0-SNAPSHOT.war $WKDIR/build-output/mrt-store-${TAG_PUB}.war
mkdir -p $WKDIR/build-output/mrt-store
jar uf $WKDIR/build-output/mrt-store/mrt-store-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
mkdir -p $ARTIFACTS/mrt-store
cp $WKDIR/mrt-services/store/mrt-store/store-war/target/mrt-storewar-1.0-SNAPSHOT.war $ARTIFACTS/mrt-store/mrt-store-${TAG_PUB}.war
jar uf $ARTIFACTS/mrt-store/mrt-store-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
fi

if check_maven_profile 'replic'
then
cp $WKDIR/mrt-services/replic/mrt-replic/replication-war/target/mrt-replicationwar-1.0-SNAPSHOT.war $WKDIR/build-output/mrt-replic-${TAG_PUB}.war
mkdir -p $WKDIR/build-output/mrt-replic
jar uf $WKDIR/build-output/mrt-replic/mrt-replic-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
mkdir -p $ARTIFACTS/mrt-replic
cp $WKDIR/mrt-services/replic/mrt-replic/replication-war/target/mrt-replicationwar-1.0-SNAPSHOT.war $ARTIFACTS/mrt-replic/mrt-replic-${TAG_PUB}.war
jar uf $ARTIFACTS/mrt-replic/mrt-replic-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
fi

if check_maven_profile 'ingest'
then
cp $WKDIR/mrt-services/ingest/mrt-ingest/ingest-war/target/mrt-ingestwar-1.0-SNAPSHOT.war $WKDIR/build-output/mrt-ingest-${TAG_PUB}.war
mkdir -p $WKDIR/build-output/mrt-ingest
jar uf $WKDIR/build-output/mrt-ingest/mrt-ingest-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
mkdir -p $ARTIFACTS/mrt-ingest
cp $WKDIR/mrt-services/ingest/mrt-ingest/ingest-war/target/mrt-ingestwar-1.0-SNAPSHOT.war $ARTIFACTS/mrt-ingest/mrt-ingest-${TAG_PUB}.war
jar uf $ARTIFACTS/mrt-ingest/mrt-ingest-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
fi

if check_maven_profile 'audit'
then
cp $WKDIR/mrt-services/audit/mrt-audit/audit-war/target/mrt-auditwarpub-1.0-SNAPSHOT.war $WKDIR/build-output/mrt-audit-${TAG_PUB}.war
mkdir -p $WKDIR/build-output/mrt-audit
jar uf $WKDIR/build-output/mrt-audit/mrt-audit-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
mkdir -p $ARTIFACTS/mrt-audit
cp $WKDIR/mrt-services/audit/mrt-audit/audit-war/target/mrt-auditwarpub-1.0-SNAPSHOT.war $ARTIFACTS/mrt-audit/mrt-audit-${TAG_PUB}.war
jar uf $ARTIFACTS/mrt-audit/mrt-audit-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
fi

if check_maven_profile 'inventory'
then
cp $WKDIR/mrt-services/inventory/mrt-inventory/inv-war/target/mrt-invwar-1.0-SNAPSHOT.war $WKDIR/build-output/mrt-inventory-${TAG_PUB}.war
mkdir -p $WKDIR/build-output/mrt-inventory
jar uf $WKDIR/build-output/mrt-inventory/mrt-inventory-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
mkdir -p $ARTIFACTS/mrt-inventory
cp $WKDIR/mrt-services/inventory/mrt-inventory/inv-war/target/mrt-invwar-1.0-SNAPSHOT.war $ARTIFACTS/mrt-inventory/mrt-inventory-${TAG_PUB}.war
jar uf $ARTIFACTS/mrt-inventory/mrt-inventory-${TAG_PUB}.war -C `dirname $BUILD_TXT` `basename $BUILD_TXT`
fi
fi
else
Expand Down Expand Up @@ -527,6 +519,7 @@ LOGSCAN=${WKDIR}/build-output/build-log.trivy-scan.txt
LOGSCANFIXED=${WKDIR}/build-output/build-log.trivy-scan-fixed.txt
LOGMAVEN=${WKDIR}/build-output/build-log.maven.txt
JOBSTAT=${WKDIR}/build-output/jobstat.txt
ARTIFACTS=${WKDIR}/build-output/artifacts

init_log_files

Expand Down Expand Up @@ -555,10 +548,14 @@ show_flags
build_integration_test_images
# Build artifacts with maven
build_maven_artifacts

# Build Merritt microservice docker images for docker testing
build_microservice_images
# Build supporting docker images for docker testing
build_docker_stack_support_images
if test_flag 'build-stack'
then
build_microservice_images
# Build supporting docker images for docker testing
build_docker_stack_support_images
fi

# Build all other docker iamges used by Merritt (for daily scanning)
if test_flag 'build-support'
Expand Down
14 changes: 14 additions & 0 deletions build-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
flagsets:
# run only docker builds, do not run maven
docker: &docker
build-stack: true
push: true
scan-unfixable: false
scan-fixable: false
Expand All @@ -16,6 +17,7 @@ flagsets:
build-support: false
# run docker and maven buids
buildonly: &buildonly
build-stack: true
push: false
scan-unfixable: false
scan-fixable: false
Expand All @@ -24,12 +26,20 @@ flagsets:
build-support: false
# run docker and maven builds, include maven tests
buildtest: &buildtest
build-stack: true
push: false
scan-unfixable: false
scan-fixable: false
run-maven: true
run-maven-tests: test
build-support: false
jenkins: &jenkins
build-stack: false
push: false
scan-unfixable: false
scan-fixable: false
run-maven: true
run-maven-tests: test
build-config:
main:
tags: &maintags
Expand Down Expand Up @@ -62,3 +72,7 @@ build-config:
<<: *buildtest
tags:
<<: *maintags
main-jenkins:
<<: *jenkins
tags:
<<: *maintags

0 comments on commit 7d9d5f0

Please sign in to comment.