Skip to content

Instantly share code, notes, and snippets.

@ftclausen
Last active August 10, 2023 03:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftclausen/7e746ddf5d18247a9692897b944f26b1 to your computer and use it in GitHub Desktop.
Save ftclausen/7e746ddf5d18247a9692897b944f26b1 to your computer and use it in GitHub Desktop.
Jenkins pipeline very simple mock steps to test things in a standalone script
# For a more realistic simulation see https://stackoverflow.com/questions/50165079/mocking-jenkins-pipeline-steps
def readFile( Map args ) {
def file = args.file
def encoding = args.file ?: 'UTF-8'
return new File( file ).text
}
def sh( String command ) {
println command
}
def dir( String dir, Closure code ) {
println "cd $dir"
code.call()
}
def echo( String msg ) {
echo msg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment