Skip to content

Instantly share code, notes, and snippets.

@unakatsuo
Last active December 29, 2021 17:03
Show Gist options
  • Save unakatsuo/a79a5f103584112f5c114e38365a851c to your computer and use it in GitHub Desktop.
Save unakatsuo/a79a5f103584112f5c114e38365a851c to your computer and use it in GitHub Desktop.
Jenkins Job DSL embedded variables
this.binding.variables.each {
out.println "${it.key} = ${it.value} (${it.value.class})"
}
out.println SEED_JOB.name
out.println SEED_JOB.lastBuild.class
def seed_scm = SEED_JOB.getSCMs()[0]
out.println seed_scm.userRemoteConfigs[0].url
//@groovy.transform.Field
// Guessing workspace path from current groovy script file.
out.println new File(this.binding.getVariable('__FILE__') + "../../../../").getCanonicalPath()
SEED_WORKSPACE=new File(this.binding.getVariable('__FILE__') + "../../../../").getCanonicalPath()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment