No such DSL method 'pipeline' found among steps

不羁岁月 提交于 2021-02-08 14:59:57

问题


I keep getting this error for the declarative pipeline script in Jenkins.

No such DSL method 'pipeline' found among steps

My script is like this

pipeline {
    agent any
    stages {
        stage('Example Build') {
            steps {
                echo 'Hello World'
            }
        }
    }
}

I have Jenkins version 2.19.4. Hopefully i have installed all the required plugins. Why do i get this exception ?


回答1:


I think you have installed the latest plugins, 1.2. I had the same issue that after I upgraded the Pipeline: Model Definition to 1.2 my pipelines stopped working. I was unable to downgrade the plugins (this broke evertyhing) and was forced to upgrade from 2.46.1 to 2.73.1, only after this I was able to run the pipelines again.

Anyway, I would recommend to upgrade as other codes that were not working for me for some reason in 2.46 are now working.




回答2:


You may need to install the Jenkins Pipeline plugin. I had this issue on a new instance of Jenkins and this plugin solved my 'No such DSL method 'pipeline' found among steps' issue.

Below is the link: https://wiki.jenkins.io/display/JENKINS/Pipeline+Plugin



来源:https://stackoverflow.com/questions/46533900/no-such-dsl-method-pipeline-found-among-steps

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