Skip to content

Instantly share code, notes, and snippets.

@jglick
Last active August 26, 2025 18:51
Show Gist options
  • Select an option

  • Save jglick/86a30894446ed38f918050c1180483e2 to your computer and use it in GitHub Desktop.

Select an option

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
# For CD-like flows using tagged maven-release-plugin commits not in the development branch:
BASE=1.456
BASETAG=${BASE}
FIX=abcd1234
git checkout -b ${BASE}.x ${BASETAG}^ # branch at parent, not MRP commit!
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
git push
# trigger release from 1.456.x branch
@basil
Copy link
Copy Markdown

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
Copy Markdown
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