Get active Jira sprint name from CLI

When you do some CI/CD jobs you might want to mark some builds with name of the current (active) Jira sprint.

We have a dozen components in the project with dedicated Jira projects and sprint names are like “Backend sprint 12”, so you probably don’t want to add useless information to the build and need only number to identify build.

Jira has a nice REST, so you can get what you want in a very simple way:

[pastacode lang=”java” path_id=”7a506a27c66203fd077643f6e111a6d7″ file=”” highlight=”” lines=”” provider=”gist”/]

And you can cat currentSprint.txt from WORKSPACE in any further build step:

I hope this info will be useful to you, and if you need any help feel free to use contact from on the main page.