jenkinsci/git-changelog-plugin

CustomIssue not working in Pipeline

Closed this issue · 1 comments

Hi,

I'm trying to use the gitChangeLog plugin in my jenkinsfile but the customIssue parameter seems to not work properly.
In the generated snippet, the parameter "pattern" is missing even if the field is properly set.
By adding it manually I still have a nullPointerExecption.

Here the script from my jenkinsfile

script {
	def changelog = gitChangelog ignoreCommitsWithoutIssue: false,
		customIssues:  [[link: '', name: 'Changed', pattern: 'Changed:', title: 'Changed']],
		removeIssueFromMessage: true, 
		returnType: 'STRING',
		untaggedName: 'Unreleased',
		template: """
		template
		"""
	echo "changelog"
}
     

& the output in Jenkins log

java.lang.NullPointerException: pattern
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
	at se.bjurr.gitchangelog.internal.settings.SettingsIssue.<init>(SettingsIssue.java:37)
	at se.bjurr.gitchangelog.api.GitChangelogApi.withCustomIssue(GitChangelogApi.java:158)
	at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.perform(GitChangelogStep.java:377)
	at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.access$000(GitChangelogStep.java:47)
	at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1$1.call(GitChangelogStep.java:325)
	at hudson.FilePath.act(FilePath.java:1096)
	at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1.run(GitChangelogStep.java:329)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
	at hudson.security.ACL.impersonate(ACL.java:290)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

  • Plugin version used - 2.3.
  • Jenkins version used - 2.117

You can change pattern to issuePattern to fix this.

I'm releasing a fix to make the snippet generator generating correct script.