简体   繁体   中英

Groovy error in Jenkins declarative pipeline

I have installed Jenkins on Docker and created a declarative pipeline from SCM. The Jenkinsfile is placed on Github and has following code:

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building..'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing..'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying....'
            }
        }
    }
}

Now whenever I build the Jenkins job I get the following error

 Running in Durability level: MAX_SURVIVABILITY
    [Pipeline] End of Pipeline
    groovy.lang.MissingPropertyException: No such property: pipeline for class: groovy.lang.Binding
        at groovy.lang.Binding.getVariable(Binding.java:63)
 jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    Finished: FAILURE

And when I place the code from Jenkinsfile on Github directly to Jenkins, then it builds successfully. Not sure what is the issue, though the same thing had worked earlier(I have fresh installed Jenkins on Docker)

将脚本安全性插件升级到v1.46(最新)后,它对我有用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM