Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-46482 Migrate implementation from Parameter concept to Enviro…
…nment variables. Using Environment because theoretically what we are trying to do here is not parameters. Update acceptance test to assert environment instead of parameter. Update JenkinsBlockingQueue to return scheduled jobs instead of queue item. This is necessary as the 'environment' variable is only available in a build object.
- Loading branch information
Showing
6 changed files
with
90 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/groovy/com/ceilfors/jenkins/plugins/jiratrigger/ParameterMappingAction.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.ceilfors.jenkins.plugins.jiratrigger | ||
|
||
import com.atlassian.jira.rest.client.api.domain.Issue | ||
import com.ceilfors.jenkins.plugins.jiratrigger.parameter.ParameterMapping | ||
import hudson.EnvVars | ||
import hudson.model.AbstractBuild | ||
import hudson.model.EnvironmentContributingAction | ||
|
||
/** | ||
* @author ceilfors | ||
*/ | ||
class ParameterMappingAction implements EnvironmentContributingAction { | ||
|
||
private final Issue issue | ||
private final List<ParameterMapping> parameterMappings | ||
|
||
ParameterMappingAction(Issue issue, List<ParameterMapping> parameterMappings) { | ||
this.issue = issue | ||
this.parameterMappings = parameterMappings | ||
} | ||
|
||
@Override | ||
void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) { | ||
parameterMappings.each { parameterMapping -> | ||
env.put(parameterMapping.jenkinsParameter, | ||
parameterMapping.parameterResolver.resolve(issue).value as String) | ||
} | ||
} | ||
|
||
@Override | ||
String getIconFileName() { | ||
null | ||
} | ||
|
||
@Override | ||
String getDisplayName() { | ||
null | ||
} | ||
|
||
@Override | ||
String getUrlName() { | ||
null | ||
} | ||
} |