-
-
Save idletekz/7d04e3ac6929ec073817e68585832c89 to your computer and use it in GitHub Desktop.
How to run an external script from source control in the Jenkins Build Flow plugin DSL
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
// | |
// Copy this into your Jenkins Build Flow plugin DSL, and call run_workspace_script() with the name of your checked in script | |
// | |
// Based on code at http://jorgemanrubia.net/2009/10/10/evaluating-code-dynamically-in-groovy | |
// | |
def run_workspace_script(filename) { | |
def code = new File(build.workspace.child(filename).toString()).text | |
def code_as_closure = "{->${code}}" | |
def closure = evaluate(code_as_closure) | |
closure.delegate=this | |
closure() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment