JIRA issues in branch name not showing up in changelog
Closed this issue · 6 comments
This is the commits list on our master branch:
On a freestyle job,
and these are the reported issues:
(...)
Jira-Tickets mentioned in commits between 7.3.2 and 7.3.3-7:
NCO-7265,NCO-7504,NCO-7515
http://whatever.com/issues/?jql=key%20in%20%28NCO-7265,NCO-7504,NCO-7515%29
(...)
but for a pipeline script using the gitChangelog step:
echo "from " + previousTag + " to " + repositoryVersion
def changelogContext = gitChangelog returnType: 'CONTEXT',
from: [type: 'REF', value: previousTag],
to: [type: 'REF', value: repositoryVersion]
Set<String> issueIdentifiers = new TreeSet<>()
changelogContext.issues.each { issue ->
if (issue.name == 'Jira') {
issueIdentifiers.add(issue.issue)
}
}
echo "found issues: ${issueIdentifiers}"
it only reports the following issue keys:
(...)
from 7.3.2 to 7.3.3-7
[Pipeline] gitChangelog
[Pipeline] }
[Pipeline] // dir
[Pipeline] echo
found issues: [NCO-7504]
(...)
am I doing something wrong?
Thanks in advance.
Luis
I can only see NCO-7504 in the screenshot you attached. The output from git log
would be better.
Also it differs because this plugin is a merge of 2 plugins. And the code used when configuring the GUI like you did is not the same as the one used when writing that pipeline.
Perhaps try rendering a full changelog, like in the README, with commit hashes and messages. Between these tags. That should give a clear picture of what is happening.
Check the "Merge pull request" messages. These include the feature/bugfix branch names merged to master and containing the other issue keys. I'll try the full changelog as suggested.
even with ignoreCommitsIfMessageMatches: "", the only issue found is NCO-7504
I think I found the problem. A workaround would be to set the ignored pattern to something that will never exist in any commit. Like this:
node {
stage("clone") {
deleteDir()
sh "git clone https://github.com/tomasbjerre/sandbox.git ."
}
stage("changelog") {
def changelogContext = gitChangelog returnType: 'CONTEXT',
from: [type: 'REF', value: "7.3.2"],
to: [type: 'REF', value: "7.3.3-7"],
ignoreCommitsIfMessageMatches: 'asdasdasdasd'
Set<String> issueIdentifiers = new TreeSet<>()
changelogContext.issues.each { issue ->
if (issue.name == 'Jira') {
issueIdentifiers.add(issue.issue)
}
}
echo "found issues: ${issueIdentifiers}"
changelogContext.commits.each {
println "msg: "+it.message
}
}
}
I'll work on a fix for this!
I'm releasing 2.6 now with a fix. So that you don't need to specify ignoreCommitsIfMessageMatches
. Should be available in update site within a few hours.