Calling pipelineJob from groovy script returns : java.lang.NoSuchMethodError: No such DSL method 'pipelineJob' found among steps

回眸只為那壹抹淺笑 提交于 2020-12-15 06:24:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!