DoingItNow
DoingItNow

Reputation: 91

Jenkinsfile Declarative Pipeline - no such property pipeline class

I have created a basic declarative pipeline on Jenkins. When I run the build it spits outs the following error

groovy.lang.MissingPropertyException: No such property: pipeline for class: groovy.lang.Binding
    at groovy.lang.Binding.getVariable(Binding.java:63)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:130)
    at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
    at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
    at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
    at WorkflowScript.run(WorkflowScript:2)
    at ___cps.transform___(Native Method)

The Jenkins Server is set to default with the default plugins which are at the latest version. The Jenkinsfile is shown below

pipeline {
  agent any

   stages {
      stage('Sample Stage') {
          steps {
              sh '''
                ls
              '''
          }
      }
   }
}

It looks like the pipeline block is failing when Jenkins reads the Jenkinsfile which is rather confusing at the Jenkinsfile looks fine to me.

Upvotes: 1

Views: 1787

Answers (2)

DoingItNow
DoingItNow

Reputation: 91

Seems that Script Security Plugin 1.45 broke all the pipeline code

Upvotes: 2

Michael A.
Michael A.

Reputation: 1209

This happened because you're running script in sandbox mode. Functions like pipeline are not published over there. It was out of the sandbox up to version 1.44 of the Script Security Plugin.

If you wish to run single branch pipeline - just unmark "Use Groovy Sandbox" at the bottom of your job settings page. If you're using multibranch pipeline then possibly the only way for you is to downgrade the plugin.

Upvotes: 1

Related Questions