Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45081

Error Checking If Pipeline is Declarative or Scripted

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I use a global variable vars/atm.groovy, which has an internal method pipeline(Closure body) (It was created because the Declarative Pipeline overwritten my old variable vars/pipeline.groovy).

      I was running my scripts without problems until now with:

      atm.pipeline { ... }

      but after updating the plugins, the following error started to occur:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
       WorkflowScript: 3: Expected a block with the "pipeline" step @ line 3, column 1.
       atm.pipeline { ^ 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:516) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:479) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:252) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) 

      I solved the problem with the following workaround:

      def gambiarra = atm.pipeline {...}

      and the script returned to work correctly. Ie, there is some problem during the verification if a pipeline is declarative or scripted.

        Attachments

          Issue Links

            Activity

            valones Flávio Augusto Valones created issue -
            valones Flávio Augusto Valones made changes -
            Field Original Value New Value
            Description I use a global variable {{vars/atm.groovy}}, which has an internal method {{pipeline(Closure body)}} (It was created because the Declarative Pipeline overwritten my old variable {{vars/pipeline.groovy}}).

            I was running my scripts with {{atm.pipeline \{ ... } }}without problems until now, but after updating the plugins, the following error started to occur:
            {code:java}
            org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
             WorkflowScript: 3: Expected a block with the "pipeline" step @ line 3, column 1.
             atm.pipeline { ^ 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:516) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:479) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:252) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) {code}
            I solved the problem with the following workaround: {{def gambiarra = atm.pipeline \{...} }}and the script returned to work correctly. Ie, there is some problem during the verification if a pipeline is declarative or scripted.
            I use a global variable {{vars/atm.groovy}}, which has an internal method {{pipeline(Closure body)}} (It was created because the Declarative Pipeline overwritten my old variable {{vars/pipeline.groovy}}).

            I was running my scripts without problems until now with:
            {code:java}
            atm.pipeline { ... }{code}
            but after updating the plugins, the following error started to occur:
            {code:java}
            org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
             WorkflowScript: 3: Expected a block with the "pipeline" step @ line 3, column 1.
             atm.pipeline { ^ 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:516) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:479) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:252) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) {code}
            I solved the problem with the following workaround:
            {code:java}
            def gambiarra = atm.pipeline {...}{code}
            and the script returned to work correctly. Ie, there is some problem during the verification if a pipeline is declarative or scripted.
            jglick Jesse Glick made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s pipeline [ 21692 ]
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            Hide
            abayer Andrew Bayer added a comment -

            ha! That's annoying. Sorry for that - I'll figure it out!

            Show
            abayer Andrew Bayer added a comment - ha! That's annoying. Sorry for that - I'll figure it out!
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            Show
            abayer Andrew Bayer added a comment - And a PR fixing it - https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/166
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #166 (Web Link)" [ 17214 ]
            Hide
            abayer Andrew Bayer added a comment - - edited

            Will be in the upcoming 1.1.9 release.

            Show
            abayer Andrew Bayer added a comment - - edited Will be in the upcoming 1.1.9 release.
            abayer Andrew Bayer made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/resources/objectMethodPipelineCall.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/8533d4c5dafe9c68516e3376772ea12a206bc29f
            Log:
            [FIXED JENKINS-45081] Don't error out for foo.pipeline

            { ... }
            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/resources/objectMethodPipelineCall.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/8533d4c5dafe9c68516e3376772ea12a206bc29f Log: [FIXED JENKINS-45081] Don't error out for foo.pipeline { ... }
            Hide
            valones Flávio Augusto Valones added a comment -

            Wow, thanks for the quick fix! Keep with the great work

            Show
            valones Flávio Augusto Valones added a comment - Wow, thanks for the quick fix! Keep with the great work

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                valones Flávio Augusto Valones
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: