From 6e91149b0a77712a88efa89c871c6ca0647ccbdb Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Fri, 22 Nov 2024 10:21:22 -0600 Subject: [PATCH] Feedback from code review --- .circleci/adjust-pom-version.sh | 25 +++++++++++++++++++++---- .circleci/config.yml | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.circleci/adjust-pom-version.sh b/.circleci/adjust-pom-version.sh index e6e6acef..2d139812 100755 --- a/.circleci/adjust-pom-version.sh +++ b/.circleci/adjust-pom-version.sh @@ -1,13 +1,24 @@ #!/bin/bash -## todo - some version of: -## - main (or -version tag?) noop? -## - dev ... replace -SNAPSHOT w/ -${timestamp} -## - other tags ... replace -SNAPSHOT w/ -${tag}-${timestamp} +############################################################################ +## adjust-pom.version.sh +## During CircleCI builds - edit the qqq parent pom.xml, to set the +## value such that: +## - feature-branch builds, tagged as snapshot-*, deploy with a version +## number that includes that tag's name (minus the snapshot- part) +## - integration-branch builds deploy with a version number that includes +## the branch name slugified +## - we never deploy -SNAPSHOT versions any more - because we don't believe +## it is ever valid to not know exactly what versions you are getting +## (perhaps because we are too loose with our versioning?) +############################################################################ POM=$(dirname $0)/../pom.xml echo "On branch: $CIRCLE_BRANCH, tag: $CIRCLE_TAG..." +###################################################################### +## ## only do anything if the committed pom has a -SNAPSHOT version ## +###################################################################### REVISION=$(grep '' $POM | sed 's/.*//;s/<.*//'); echo " in pom.xml is: $REVISION" if [ \! $(echo "$REVISION" | grep SNAPSHOT) ]; then @@ -15,6 +26,9 @@ if [ \! $(echo "$REVISION" | grep SNAPSHOT) ]; then exit 0; fi +################################################################################## +## ## figure out if we need a SLUG: a snapshot- tag, or an integration/ branch ## +################################################################################## SLUG="" if [ $(echo "$CIRCLE_TAG" | grep ^snapshot-) ]; then SLUG=$(echo "$CIRCLE_TAG" | sed "s/^snapshot-//")- @@ -25,6 +39,9 @@ elif [ $(echo "$CIRCLE_BRANCH" | grep ^integration/) ]; then echo "Using slug [$SLUG] from branch [$CIRCLE_BRANCH]" fi +################################################################ +## ## build the replcaement for -SNAPSHOT, and update the pom ## +################################################################ TIMESTAMP=$(date +%Y%m%d-%H%M%S) REPLACEMENT=${SLUG}${TIMESTAMP} diff --git a/.circleci/config.yml b/.circleci/config.yml index 7df4090c..4fffc467 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,7 +105,7 @@ commands: - run: name: Run Maven Jar Deploy command: | - mvn -s .circleci/mvn-settings.xml -T4 flatten:flatten jar:jar deploy:deploy -DuniqueVersion=false + mvn -s .circleci/mvn-settings.xml -T4 flatten:flatten jar:jar deploy:deploy - save_cache: paths: - ~/.m2