Skip to content

Instantly share code, notes, and snippets.

@lepffm
Created June 24, 2020 01:17
Show Gist options
  • Save lepffm/e9d47446321a8a07cc66d032ced3927b to your computer and use it in GitHub Desktop.
Save lepffm/e9d47446321a8a07cc66d032ced3927b to your computer and use it in GitHub Desktop.
jenkinsfile paser example with modeldefinition plugin ( jenkins script console)
def str = '''
pipeline {
agent any
stages {
stage('Hello') {
steps {
echo 'Hello World'
sh 'pwd'
}
}
}
}
'''
def pipdef = org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter.scriptToPipelineDef(str)
println 'stage='+pipdef.stages.stages.collect{it.name}.join()
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment