Skip to content
Permalink
Browse files

JENKINS-46836 Convert parameterResolver null return value to empty st…

…ring.
  • Loading branch information
ceilfors committed Apr 21, 2018
1 parent a41c2ad commit 9375c1b6141fcb6ff12873e7151dbe99e87a951a
@@ -109,6 +109,25 @@ class JiraTriggerIntegrationTest extends Specification {
build.getEnvironment(TaskListener.NULL).get('JIRA_ISSUE_KEY') == 'TEST-1234'
}

@Issue('JENKINS-46836')
def 'Should be able to set parameter mapping when value resolved is null'() {
given:
def issue = TestUtils.createIssue('TEST-1234')
def project = jenkins.createJiraCommentTriggeredProject('job')
jenkins.quietPeriod = 0
project.addParameterMapping('ASSIGNEE', 'assignee')

when:
def scheduledProjects = jenkins.jiraTriggerExecutor.scheduleBuilds(
issue, TestUtils.createComment(JiraCommentTrigger.DEFAULT_COMMENT))

then:
issue.assignee == null
scheduledProjects.size() != 0
AbstractBuild build = jenkins.getScheduledBuild(scheduledProjects[0])
build.getEnvironment(TaskListener.NULL).get('ASSIGNEE') == ''
}

@Issue('JENKINS-41878')
def 'Should not serialize any Atlassian issue object into build.xml'() {
given:
@@ -12,7 +12,7 @@ class ParameterMappingAction extends ParametersAction {

ParameterMappingAction(Issue issue, List<ParameterMapping> parameterMappings) {
super(parameterMappings.collect { p ->
new StringParameterValue(p.jenkinsParameter, p.parameterResolver.resolve(issue))
new StringParameterValue(p.jenkinsParameter, p.parameterResolver.resolve(issue) ?: '')
}, parameterMappings*.jenkinsParameter)
}
}

0 comments on commit 9375c1b

Please sign in to comment.
You can’t perform that action at this time.