Generate JIRA release note through a jenkins job without plugins

I know that this is possible through the JIRA-JENKINS plugin. But I'm not an administrative user neither in JIRA nor Jenkins. Therefore I want to know is it possible to generate JIRA release note through a jenkin job without installing any plugins to JIRA or JENKINS?

Upvotes: 0

Views: 7285

Answers (2)

Manuel Pintaldi
Manuel Pintaldi

Reputation: 1065

Ok, I did it just now, here is my solution (that is a mix of several partial solution I have found googling):

In your deploy jobs, add a shell execution step at the end of the job and replace all parameters of the following script with correct values

version=<your_jira_version> ##(for example 1.0.71)

project_name=<your_jira_project_key> ##(for example PRJ)

jira_version_id=$(curl --silent -u <jira_user>:<jira_password> -X GET -H "Content-Type: application/json" "https://<your_jira_url>/rest/api/2/project/${project_name}/versions" | jq "map(select(.[\"name\"] == \"$version\")) | .[0] | .id" | sed -e 's/^"//'  -e 's/"$//')

project_id=$(curl --silent -u <jira_user>:<jira_password> -X GET -H "Content-Type: application/json" "https://<your_jira_url>/rest/api/2/project/${project_name}" | jq .id | sed -e 's/^"//'  -e 's/"$//')

release_notes_page="https://<your_jira_url>/secure/ReleaseNote.jspa?version=${jira_version_id}&styleName=Text&projectId=${project_id}"

release_notes=$(curl --silent -D- -u <jira_user>:<jira_password> -X GET -H "Content-Type: application/json" "$release_notes_page")

rm -rf releasenotes.txt

echo "$release_notes" | sed -n "/<textarea rows=\"40\" cols=\"120\">/,/<\/textarea>/p" | grep -v "textarea" > releasenotes.txt

Upvotes: 5

dunni
dunni

Reputation: 44545

You can use the maven-changes-plugin. You have to create a small maven project (doesn't need any sources) and include the plugin in the plugins section with the necessary configuration (see here: http://maven.apache.org/plugins/maven-changes-plugin/jira-report-mojo.html)

Then you create a Jenkins job, and just execute the maven goals you need (most probably just "mvn changes:jira-report").

Upvotes: 1

Related Questions