Skip to content

Instantly share code, notes, and snippets.

@jglick
Last active June 10, 2024 20:52
Show Gist options
  • Save jglick/86a30894446ed38f918050c1180483e2 to your computer and use it in GitHub Desktop.
Save jglick/86a30894446ed38f918050c1180483e2 to your computer and use it in GitHub Desktop.
Example of setting up a Jenkins plugin backport branch
BASE=1.19 # or whatever; last release compatible with targeted core or other deps
BASETAG=mystuff-${BASE} # or as per http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#tagNameFormat
FIX=abcd1234 # whatever the backportable fix was, in master or somewhere newer than $BASE
git checkout -b ${BASE}.x $(git log --reverse --ancestry-path --pretty=%H ${BASETAG}..master | head -1)
# or for JEP-305 (“Incrementals”) use: mvn versions:set-property -Dproperty=revision -DnewVersion=${BASE}.1
mvn versions:set -DnewVersion=${BASE}.1-SNAPSHOT -DgenerateBackupPoms=false
git commit -a -m "Prepare for ${BASE}.1"
git push -u origin ${BASE}.x
git cherry-pick -x -m1 $FIX
mvn -B release:{prepare,perform}
# For JEP-229 (“CD”):
BASE=99 # numeric component of base commit
BASETAG=${BASE}.v1234deadbeef # whatever $(mvn -Dset.changelist validate) said
FIX=abcd1234 # as before
git checkout -b ${BASE}.x ${BASETAG}
sed -i -e 's!<version>${changelist}</version>!<version>'$BASE'.${changelist}</version>!g' {,*/}pom.xml # versions:set does not work
git commit -a -m "Prepare for ${BASE}.x"
git push -u origin ${BASE}.x
git cherry-pick -x -m1 $FIX
git push
# manually trigger release from 99.x branch
@basil
Copy link

basil commented Aug 25, 2022

Of note when doing this for JEP-229 plugins is that in a Maven multi-module project you will not only have to edit pom.xml in the root project but also in each module as well.

@jglick
Copy link
Author

jglick commented Aug 25, 2022

you will not only have to edit pom.xml in the root project but also in each module as well

Good point; edited suggestion accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment