Created
February 20, 2018 20:23
-
-
Save t3knoid/24688a0f8c3631d7e907fbc8626f7d50 to your computer and use it in GitHub Desktop.
This is an example on how to parse arguments passed to a groovy script
This file contains hidden or 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 is an example on how to parse arguments passed to a groovy script | |
import jenkins.model.* | |
if (args.length != 2 ) { | |
println "Error on arguments!" | |
} | |
def jobName = args[0] ?: 'a_job' | |
def viewName = args[1] ?: 'a_view' | |
println jobName + ' ' + viewName | |
def v = Jenkins.instance.getView(viewName) | |
def i = Jenkins.instance.getItemByFullName(jobName) | |
if (v && i) { | |
v.add(i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment