Created
December 6, 2016 12:43
-
-
Save rodrigozrusso/a3356dd8df88e8aff8cb47499de17e33 to your computer and use it in GitHub Desktop.
Jenkins retrieve EnvVar from Another job and inject in the build.
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
import jenkins.*; | |
import jenkins.model.*; | |
import hudson.*; | |
import hudson.model.*; | |
def item = Jenkins.getInstance().getItemByFullName("my-awesome-job") | |
//build = item.getBuildByNumber("$buildNumberFromParameter".toInteger()) | |
build = item.getBuildByNumber(1234) | |
def var = build.getEnvVars()['SpecificEnvOrParam'] | |
def map = [MY_VAR: var] | |
return map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment