Skip to content

Instantly share code, notes, and snippets.

@solvingj
Last active February 8, 2019 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solvingj/464f507f6753105b44dd04f3b4b2ebb9 to your computer and use it in GitHub Desktop.
Save solvingj/464f507f6753105b44dd04f3b4b2ebb9 to your computer and use it in GitHub Desktop.
JenkinsGroovyClosuresPrettyCoolStuff
def call(String name, Closure body) {
echo "Hello, ${name} first."
body(test)
}
@Library('myNamePrinterLibrary') _
pipeline {
stages {
stage('printNameTwice') {
steps{
withNamePrinter("frankenstein"){name ->
echo "Hello, ${name} second."
}
}
}
}
}
[Pipeline] { (printNameTwice)
[Pipeline] echo
Hello, frankenstein first.
[Pipeline] echo
Hello, frankenstein second.
[Pipeline] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment