Sometimes it is useful to directly work with Jenkins model objects from a Workflow, such as the FilePath representing the workspace for the enclosing node block. Currently you cannot access these. It would be useful to have a Step which just gave access to a specified contextual object (given as a String class name I suppose). Typically you would need to run in whole-script approval mode, since relevant methods on such objects are not likely to be safe to whitelist for use from the sandbox.

          [JENKINS-28385] Step to obtain raw contextual objects

          Jesse Glick added a comment -

          Might be useful in some cases for JENKINS-37011.

          Jesse Glick added a comment - Might be useful in some cases for JENKINS-37011 .

          Jesse Glick added a comment -

          For JENKINS-37011 or trusted libraries it would perhaps be useful to have two (advanced!) steps: context, taking a Class (no need for Snippetizer support), and returning Object; and withContext, taking Object and a block. The combination could allow AntStepExecution in ant PR 22 to bypass ConsoleLogFilterStep.

          Jesse Glick added a comment - For JENKINS-37011 or trusted libraries it would perhaps be useful to have two (advanced!) steps: context , taking a Class (no need for Snippetizer support), and returning Object ; and withContext , taking Object and a block. The combination could allow AntStepExecution in ant PR 22 to bypass ConsoleLogFilterStep .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/html.groovy
          http://jenkins-ci.org/commit/workflow-cps-plugin/4c00f998882610b0229c2137837b5be9a42749df
          Log:
          Merge pull request #79 from jglick/Object-parameter-JENKINS-28385

          JENKINS-28385 Gracefully handle Describable attributes of type Object

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/c56e0c5ac581...4c00f9988826

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/html.groovy http://jenkins-ci.org/commit/workflow-cps-plugin/4c00f998882610b0229c2137837b5be9a42749df Log: Merge pull request #79 from jglick/Object-parameter- JENKINS-28385 JENKINS-28385 Gracefully handle Describable attributes of type Object Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/c56e0c5ac581...4c00f9988826

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/steps/GetContextStep.java
          src/main/java/org/jenkinsci/plugins/workflow/steps/WithContextStep.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/72f7e2a99398367d36670424f2e072c3f981ac13
          Log:
          JENKINS-28385 Initial implementation of getContext & withContext steps.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/GetContextStep.java src/main/java/org/jenkinsci/plugins/workflow/steps/WithContextStep.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/72f7e2a99398367d36670424f2e072c3f981ac13 Log: JENKINS-28385 Initial implementation of getContext & withContext steps.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/steps/GetContextStep.java
          src/main/java/org/jenkinsci/plugins/workflow/steps/WithContextStep.java
          src/main/resources/org/jenkinsci/plugins/workflow/steps/GetContextStep/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/steps/GetContextStep/help.html
          src/main/resources/org/jenkinsci/plugins/workflow/steps/WithContextStep/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/steps/WithContextStep/help.html
          src/test/java/org/jenkinsci/plugins/workflow/steps/WithContextStepTest.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/bf17f230386b6441e93807e92b155a2a93f219a3
          Log:
          Merge pull request #25 from jglick/context-step-JENKINS-28385

          JENKINS-28385 getContext & withContext steps

          Compare: https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/7d6d99660008...bf17f230386b

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/GetContextStep.java src/main/java/org/jenkinsci/plugins/workflow/steps/WithContextStep.java src/main/resources/org/jenkinsci/plugins/workflow/steps/GetContextStep/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/steps/GetContextStep/help.html src/main/resources/org/jenkinsci/plugins/workflow/steps/WithContextStep/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/steps/WithContextStep/help.html src/test/java/org/jenkinsci/plugins/workflow/steps/WithContextStepTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/bf17f230386b6441e93807e92b155a2a93f219a3 Log: Merge pull request #25 from jglick/context-step- JENKINS-28385 JENKINS-28385 getContext & withContext steps Compare: https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/7d6d99660008...bf17f230386b

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: