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

Globals not accessible in Declarative Pipeline outside script directive

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      See https://github.com/jenkins-infra/jenkins.io/pull/611

      Basically, it was a design decision to not allow any form of thing.method() in Declarative. This was needed to support validation.

      It is possible to circumvent this in several ways and there are bugs that might address this, but it is a hard problem.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            Note that globals are usable within script blocks.

            Show
            abayer Andrew Bayer added a comment - Note that globals are usable within script blocks.
            Hide
            abayer Andrew Bayer added a comment -

            I've got a PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/127 with better error reporting of an object method call - doesn't enable usage of them, but does at least explain the error.

            Show
            abayer Andrew Bayer added a comment - I've got a PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/127 with better error reporting of an object method call - doesn't enable usage of them, but does at least explain the error.
            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
            pipeline-model-definition/src/test/resources/libraryObjectDefinedOutsidePipeline.groovy
            pipeline-model-definition/src/test/resources/libraryObjectOutsideScript.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/2750f57fad326f173fb81012d522dfc7639197b3
            Log:
            JENKINS-42360 Improve validation on object method calls

            Actually distinguish object method calls from generalized "expected a
            symbol", and report accordingly.

            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java pipeline-model-definition/src/test/resources/libraryObjectDefinedOutsidePipeline.groovy pipeline-model-definition/src/test/resources/libraryObjectOutsideScript.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/2750f57fad326f173fb81012d522dfc7639197b3 Log: JENKINS-42360 Improve validation on object method calls Actually distinguish object method calls from generalized "expected a symbol", and report accordingly.
            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
            pipeline-model-definition/src/test/resources/libraryObjectDefinedOutsidePipeline.groovy
            pipeline-model-definition/src/test/resources/libraryObjectOutsideScript.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/5c215ff0cdbf81bb517d34451aeb5d6a32fe7044
            Log:
            Merge pull request #127 from abayer/jenkins-42360

            JENKINS-42360 Improve validation on object method calls

            Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/faa4b12cea65...5c215ff0cdbf

            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java pipeline-model-definition/src/test/resources/libraryObjectDefinedOutsidePipeline.groovy pipeline-model-definition/src/test/resources/libraryObjectOutsideScript.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/5c215ff0cdbf81bb517d34451aeb5d6a32fe7044 Log: Merge pull request #127 from abayer/jenkins-42360 JENKINS-42360 Improve validation on object method calls Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/faa4b12cea65...5c215ff0cdbf
            Hide
            abayer Andrew Bayer added a comment -

            fyi, this was resolved because the validation improvements are all we're gonna do here - we're not actually going to allow the behavior, but now we're erroring out on more of it, at least.

            Show
            abayer Andrew Bayer added a comment - fyi, this was resolved because the validation improvements are all we're gonna do here - we're not actually going to allow the behavior, but now we're erroring out on more of it, at least.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                bitwiseman Liam Newman
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: