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

Globals not accessible in Declarative Pipeline outside script directive

    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

            bitwiseman Liam Newman created issue -
            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.
            bitwiseman Liam Newman made changes -
            Field Original Value New Value
            Summary Globals not accessible in Declarative Pipeline. Globals not accessible in Declarative Pipeline outside script directive
            bitwiseman Liam Newman made changes -
            Description See https://github.com/jenkins-infra/jenkins.io/pull/611

            I need go back over this to see what the actually behavior is.
            bitwiseman Liam Newman made changes -
            Remote Link This issue links to "PR 611 (Web Link)" [ 15497 ]
            bitwiseman Liam Newman made changes -
            Link This issue relates to WEBSITE-321 [ WEBSITE-321 ]
            bitwiseman Liam Newman made changes -
            Description See https://github.com/jenkins-infra/jenkins.io/pull/611

            I need go back over this to see what the actually behavior is.
            See https://github.com/jenkins-infra/jenkins.io/pull/611

            I need go back over this to see what the actually behavior is. Steps from shared libraries work, but Globals (defined using class) are not. Not sure about what happens without a class.


            bitwiseman Liam Newman made changes -
            Link This issue relates to JENKINS-37011 [ JENKINS-37011 ]
            bitwiseman Liam Newman made changes -
            Description See https://github.com/jenkins-infra/jenkins.io/pull/611

            I need go back over this to see what the actually behavior is. Steps from shared libraries work, but Globals (defined using class) are not. Not sure about what happens without a class.


            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. It is possible to circumvent this in several ways, and there are bugs that might address this.
            bitwiseman Liam Newman made changes -
            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. It is possible to circumvent this in several ways, and there are bugs that might address this.
            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.
            bitwiseman Liam Newman made changes -
            Link This issue relates to JENKINS-41335 [ JENKINS-41335 ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            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.
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #127 (better error reporting) (Web Link)" [ 15498 ]
            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
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Won't Fix [ 2 ]
            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.
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.
            bitwiseman Liam Newman made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              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: