Skip to content

[JENKINS-42360] Globals not accessible in Declarative Pipeline outside script directive #1000

Closed

Description

@jenkins-infra-bot

See jenkins-infra/jenkins.io#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.


Originally reported by bitwiseman, imported from: Globals not accessible in Declarative Pipeline outside script directive
  • assignee: abayer
  • status: Closed
  • priority: Major
  • component(s): pipeline-model-definition-plugin
  • resolution: Won't Fix
  • resolved: 2017-07-06T12:16:18+00:00
  • votes: 2
  • watchers: 9
  • imported: 2025-12-06
Raw content of original issue

See jenkins-infra/jenkins.io#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.

Activity

  1. jenkins-infra-bot commented on Feb 27, 2017

    @jenkins-infra-bot
    Author
  2. jenkins-infra-bot commented on Feb 27, 2017

    @jenkins-infra-bot
    Author
    abayer:
    • Comment link
    • Original comment link (no redirect)
    • Raw content of original comment:

      Note that globals are usable within script blocks.

    Note that globals are usable within script blocks.

  3. jenkins-infra-bot commented on Feb 28, 2017

    @jenkins-infra-bot
    Author
    abayer:

    I've got a PR up at #127 with better error reporting of an object method call - doesn't enable usage of them, but does at least explain the error.

  4. jenkins-infra-bot commented on Mar 1, 2017

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Comment link
    • Original comment link (no redirect)
    • Raw content of original 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.

    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.

  5. jenkins-infra-bot commented on Mar 1, 2017

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Comment link
    • Original comment link (no redirect)
    • Raw content of original 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: faa4b12...5c215ff

    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: faa4b12...5c215ff

  6. jenkins-infra-bot commented on Jul 6, 2017

    @jenkins-infra-bot
    Author
    abayer:
    • Comment link
    • Original comment link (no redirect)
    • Raw content of original 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.

    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.

  7. jenkins-infra-bot commented on Oct 23, 2019

    @jenkins-infra-bot
    Author
    bitwiseman:

    Bulk closing resolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions