Jenkins backporting toolkit is a set of scripts that assist in backporting fixes from the master branch to the LTS branch. See LTS Release Line for the process.
Prerequisite
Part of this tool is written in Groovy, other part in Ruby. You'll also need to have a Java property file in ~/.jenkins-ci.org
file that contains your jenkins-ci.org user name and password in "userName" and "password" keys. Example below:
userName=kohsuke password=xxxxx
Tool: jenkins-backport-generate-list
Usage: jenkins-backport-generate-list <MASTER-REV-LIST> <STABLE-REV-LIST>
This command takes two parameters that represent (1) commits that are made in the master branch that are subject of the backporting ("MASTER-REV-LIST") and (2) commits that are made in the stable branch ("STABLE-REV-LIST"). For more information about how to specify commits, refer to git-rev-parse man page. The command is a wrapper of git
, and it expects you to be inside the Jenkins workspace.
The typical approach is to run it like jenkins-backport-generate-list 1.X..1.Y 1.X..stable"
where 1.X is the main line release version from which LTS was branched off, and 1.Y is the latest main line release that satisfies the soaking criteria (last release -2).
The script lists up all the tickets that are marked as fixed in the master branch, except all the ones that are also marked as fixed in the stable branch. For each ticket, it'll retrieve other information about the ticket from JIRA, such as # of votes, priority, description, etc., and the result will be tabluated into an HTML table:
For each ticket it'll also list up all the commits that are needed for the fix. This process uses the commit log notation used in Jenkins, and the list of commits are written as text file in ./cherry-pick/<TICKETID>
. So for example one of them would look like the following:
% cat cherry-pick/JENKINS-10030 307fca204598d2496325455ee49b1b634e71fdf2 6b5ef4bd4aa8703f26ca7bda421171b56f9d7db9
Tool: jenkins-backport-cherry-pick
Usage: jenkins-backport-cherry-pick <TICKETID>
This command uses ./cherry-pick/*
that are left behind by jenkins-backport-generate-list
, and assits the actual cherry-pick activity. It basically runs git-cherry-pick
for each commit listed in the cherry-pick file. It will automatically resolve the conflict on ./changelog.html
that's very common during backporting, by always favoring the version in the stable branch — this is OK because the LTS changelog is generated automatically.
If a conflict occurs, it'll launch interactive shell and ask you to resolve it. You'll do so, and exit from the shell, and the script will continue where it left off. It'll commit each cherry-picked change with the special header indicating the original commit ID (git cherry-pick
doesn't do this for commits that have conflicts.)
TODO
- Switch to JIRA REST API client so that we can honor the 'lts-candidate' labels.