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

Pass NODE_NAME into node{}

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It would be useful and natural to be able to use env.NODE_NAME inside a node.

      Currently. the following code results in null:

      node('myNode') { echo "My name is ${env.NODE_NAME}" }
      

      Perhaps ExecutorStepExecution should define NODE_NAME for use by steps inside node.

        Attachments

          Issue Links

            Activity

            anshuarya Anshu Arya created issue -
            Hide
            jglick Jesse Glick added a comment -

            Yes, JENKINS-27145 discusses a few variables which you would reasonably expect to be there but which for technical reasons are not (because they are normally implemented in AbstractProject/AbstractBuild).

            Show
            jglick Jesse Glick added a comment - Yes, JENKINS-27145 discusses a few variables which you would reasonably expect to be there but which for technical reasons are not (because they are normally implemented in AbstractProject / AbstractBuild ).
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue is blocking JENKINS-27145 [ JENKINS-27145 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-28182 [ JENKINS-28182 ]
            Hide
            sumdumgai A C added a comment -

            Workaround in Windows, use ${env.COMPUTERNAME} - not perfect, but close enough for most purposes.

            Show
            sumdumgai A C added a comment - Workaround in Windows, use ${env.COMPUTERNAME} - not perfect, but close enough for most purposes.
            jglick Jesse Glick made changes -
            Description It would be useful and natural to be able to use env.NODE_NAME inside a node{}.

            Currently. the following code results in null: node('myNode') { echo "My name is ${env.NODE_NAME}" }

            Perhaps ExecutorStepExecution should define NODE_NAME for use by steps inside node {}.
            It would be useful and natural to be able to use {{env.NODE_NAME}} inside a {{node}}.

            Currently. the following code results in null:

            {code}
            node('myNode') { echo "My name is ${env.NODE_NAME}" }
            {code}

            Perhaps {{ExecutorStepExecution}} should define {{NODE_NAME}} for use by steps inside {{node}}.
            Hide
            recena Manuel Recena Soto added a comment - - edited

            There is an opened PR.

            Output result:

            Running: Allocate node : Start
            Running on test in /Users/recena/temp/jenkins-node/workspace/CJE-2418
            Running: Allocate node : Body : Start
            Running: Print Message
            My name is test
            Running: Allocate node : Body : End
            Running: Allocate node : End
            Running: End of Workflow
            Finished: SUCCESS
            
            Show
            recena Manuel Recena Soto added a comment - - edited There is an opened PR . Output result: Running: Allocate node : Start Running on test in /Users/recena/temp/jenkins-node/workspace/CJE-2418 Running: Allocate node : Body : Start Running: Print Message My name is test Running: Allocate node : Body : End Running: Allocate node : End Running: End of Workflow Finished: SUCCESS
            recena Manuel Recena Soto made changes -
            Assignee Jesse Glick [ jglick ] Manuel Jesús Recena Soto [ recena ]
            recena Manuel Recena Soto made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Resolved [ 5 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/ae1b4c965a649bdc9743e65074e3770ec8fe25cd
            Log:
            JENKINS-28131 - Pass NODE_NAME into node{}

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/ae1b4c965a649bdc9743e65074e3770ec8fe25cd Log: JENKINS-28131 - Pass NODE_NAME into node{}
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/535400df863aa3e297bee6d7a2c51c62b5d32ccc
            Log:
            JENKINS-28131 - Pass NODE_NAME into node{}

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/535400df863aa3e297bee6d7a2c51c62b5d32ccc Log: JENKINS-28131 - Pass NODE_NAME into node{}
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/AvailableEnvVarTest.java
            http://jenkins-ci.org/commit/workflow-plugin/a62d31f25434ac965d93e6dbb7ffd7aad7b2fdd8
            Log:
            JENKINS-28131 Added a new test to verify that specefic environment variables are available

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/AvailableEnvVarTest.java http://jenkins-ci.org/commit/workflow-plugin/a62d31f25434ac965d93e6dbb7ffd7aad7b2fdd8 Log: JENKINS-28131 Added a new test to verify that specefic environment variables are available
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/AvailableEnvVarTest.java
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java
            http://jenkins-ci.org/commit/workflow-plugin/b5c7f4f5b5c362ec0a9447fd668f022d398d4628
            Log:
            JENKINS-28131 Filename has been renamed to be more clear

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/AvailableEnvVarTest.java aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java http://jenkins-ci.org/commit/workflow-plugin/b5c7f4f5b5c362ec0a9447fd668f022d398d4628 Log: JENKINS-28131 Filename has been renamed to be more clear
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/f9e64a4fd9aff2b9d3f0f78280fc0dd1697cb081
            Log:
            JENKINS-28131 Checks if the executor is a Master

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/f9e64a4fd9aff2b9d3f0f78280fc0dd1697cb081 Log: JENKINS-28131 Checks if the executor is a Master
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/6a64190bfc67fbef4f91d18ff88670235ce910f4
            Log:
            JENKINS-28131 Solved a findbug issue

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/6a64190bfc67fbef4f91d18ff88670235ce910f4 Log: JENKINS-28131 Solved a findbug issue
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/a7abe6c0efab953cb8782eaef72d0cc54ec712d1
            Log:
            JENKINS-28131 Improving the test and adding some inline comments

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/a7abe6c0efab953cb8782eaef72d0cc54ec712d1 Log: JENKINS-28131 Improving the test and adding some inline comments
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/06cb328979c8772da21a12b265a69dde68024e0c
            Log:
            Merge pull request #145 from recena/master

            JENKINS-28131 - Pass NODE_NAME into node{}

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/b127fd48c37e...06cb328979c8

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/EnvWorkflowTest.java cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/06cb328979c8772da21a12b265a69dde68024e0c Log: Merge pull request #145 from recena/master JENKINS-28131 - Pass NODE_NAME into node{} Compare: https://github.com/jenkinsci/workflow-plugin/compare/b127fd48c37e...06cb328979c8
            recena Manuel Recena Soto made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            recena Manuel Recena Soto made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            http://jenkins-ci.org/commit/workflow-plugin/224578701c9e2d100267aa94fc091cebe2771b2d
            Log:
            JENKINS-28131 Noting.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/224578701c9e2d100267aa94fc091cebe2771b2d Log: JENKINS-28131 Noting.
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-31391 [ JENKINS-31391 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            http://jenkins-ci.org/commit/workflow-cps-plugin/90be82d7d689e8b48ab55b34e0d05c85af2403bf
            Log:
            JENKINS-28131 - Pass NODE_NAME into node{}

            Originally-Committed-As: ae1b4c965a649bdc9743e65074e3770ec8fe25cd

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/90be82d7d689e8b48ab55b34e0d05c85af2403bf Log: JENKINS-28131 - Pass NODE_NAME into node{} Originally-Committed-As: ae1b4c965a649bdc9743e65074e3770ec8fe25cd
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: recena
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            http://jenkins-ci.org/commit/workflow-cps-plugin/1b1eae0444f146e11985de7ce8dab4b353fbe5a1
            Log:
            JENKINS-28131 - Pass NODE_NAME into node{}

            Originally-Committed-As: 535400df863aa3e297bee6d7a2c51c62b5d32ccc

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/1b1eae0444f146e11985de7ce8dab4b353fbe5a1 Log: JENKINS-28131 - Pass NODE_NAME into node{} Originally-Committed-As: 535400df863aa3e297bee6d7a2c51c62b5d32ccc
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 162845 ] JNJira + In-Review [ 197052 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]

              People

              Assignee:
              recena Manuel Recena Soto
              Reporter:
              anshuarya Anshu Arya
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: