问题
i try to invoke programmatically pipeline using jobDSL pipelineJob method but im getting Even though it does exist as a plugin in Jenkins :
java.lang.NoSuchMethodError: No such DSL method 'pipelineJob' found among steps
this is what I'm calling :
def invoke() {
pipelineJob('example') {
definition {
cps {
script("""
pipeline {
agent any
stages {
stage('pipeline from pipelineJob'){
steps{
// script {
sh '"Hello from pipelineJob!!!!"'
// }
}
}
}
}
""")
}
}
}
}
and this called from a simple Jenkins file pipeline:
pipeline {
agent any
stages {
stage(Build'){
steps{
script {
myLib.invoke()
}
}
}
}
}
来源:https://stackoverflow.com/questions/64114279/calling-pipelinejob-from-groovy-script-returns-java-lang-nosuchmethoderror-no