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

PATH value is being overwritten in declarative pipeline syntax

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Declarative pipeline example:

      pipeline {
          agent any
          
          stages {
              stage('Without NPM'){
                  steps {
                      echo PATH
                  }
              }
              
              stage('With NPM'){
                  tools {
                      nodejs 'Node v6'
                  }
                  steps {
                      echo PATH
                  }
              }
          }
      }
      

      Output

      [Pipeline] node
      Running on master in /data/jenkins/workspace/_playground
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Without NPM)
      [Pipeline] echo
      /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (With NPM)
      [Pipeline] tool
      [Pipeline] envVarsForTool
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] echo
      /data/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_v6/bin
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

        Attachments

          Issue Links

            Activity

            Hide
            nfalco Nikolas Falco added a comment -

            Some more informations?
            Which NodeJS Plugin version you have installed?
            Which version of Jenkins do you use?
            This job runs in master Jenkins or on a slave node?

            Show
            nfalco Nikolas Falco added a comment - Some more informations? Which NodeJS Plugin version you have installed? Which version of Jenkins do you use? This job runs in master Jenkins or on a slave node?
            Hide
            mate_eke Máté Eke added a comment -

            I have the same issue - Ubuntu 16.10, Jenkins 2.32.2, NodeJS Plugin 1.1.0, and the job runs on master.
            Workaround:

            steps {
                            //Necessary still JENKINS-41947 not resolved
                            nodejs(nodeJSInstallationName: 'NodeJS', configId: null) {
                                sh 'npm install --silent'
                                sh 'node -pe "require(${packageJson}).version" > version'
                            }
                        }
            
            Show
            mate_eke Máté Eke added a comment - I have the same issue - Ubuntu 16.10, Jenkins 2.32.2, NodeJS Plugin 1.1.0, and the job runs on master. Workaround: steps { //Necessary still JENKINS-41947 not resolved nodejs(nodeJSInstallationName: 'NodeJS' , configId: null ) { sh 'npm install --silent' sh 'node -pe "require(${packageJson}).version" > version' } }
            Hide
            robwatts Robert Watts added a comment - - edited

            I also have same issue and confirm that Máté Eke's workaround works

            Show
            robwatts Robert Watts added a comment - - edited I also have same issue and confirm that Máté Eke 's workaround works
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Nikolas Falco
            Path:
            src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java
            src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java
            src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java
            http://jenkins-ci.org/commit/nodejs-plugin/ede03679a660099ff672e09348d0814c813b114d
            Log:
            JENKINS-41947 Adapt builders so that installation buildEnvVars could use EnvVar#put() method instead EnvVar#override() as described in ToolInstallation javadoc.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nikolas Falco Path: src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java http://jenkins-ci.org/commit/nodejs-plugin/ede03679a660099ff672e09348d0814c813b114d Log: JENKINS-41947 Adapt builders so that installation buildEnvVars could use EnvVar#put() method instead EnvVar#override() as described in ToolInstallation javadoc.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Nikolas Falco
            Path:
            src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java
            src/main/java/jenkins/plugins/nodejs/NodeJSConstants.java
            src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java
            src/test/java/jenkins/plugins/nodejs/CIBuilderHelper.java
            src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java
            src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java
            src/test/java/jenkins/plugins/nodejs/NodeJSInstallerTest.java
            src/test/java/jenkins/plugins/nodejs/NpmrcFileSupplyTest.java
            src/test/java/jenkins/plugins/nodejs/SimpleNodeJSCommandInterpreterTest.java
            src/test/java/jenkins/plugins/nodejs/VerifyEnvVariableBuilder.java
            src/test/java/jenkins/plugins/nodejs/tools/NodeJSInstallationMockitoTest.java
            http://jenkins-ci.org/commit/nodejs-plugin/0cd622bb5d985b3539c336a910d1f01d77d93cf6
            Log:
            JENKINS-41947 Add a bunch of unit test

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nikolas Falco Path: src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java src/main/java/jenkins/plugins/nodejs/NodeJSConstants.java src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java src/test/java/jenkins/plugins/nodejs/CIBuilderHelper.java src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java src/test/java/jenkins/plugins/nodejs/NodeJSInstallerTest.java src/test/java/jenkins/plugins/nodejs/NpmrcFileSupplyTest.java src/test/java/jenkins/plugins/nodejs/SimpleNodeJSCommandInterpreterTest.java src/test/java/jenkins/plugins/nodejs/VerifyEnvVariableBuilder.java src/test/java/jenkins/plugins/nodejs/tools/NodeJSInstallationMockitoTest.java http://jenkins-ci.org/commit/nodejs-plugin/0cd622bb5d985b3539c336a910d1f01d77d93cf6 Log: JENKINS-41947 Add a bunch of unit test
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Nikolas Falco
            Path:
            src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java
            src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java
            src/main/java/jenkins/plugins/nodejs/NodeJSConstants.java
            src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java
            src/test/java/jenkins/plugins/nodejs/CIBuilderHelper.java
            src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java
            src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java
            src/test/java/jenkins/plugins/nodejs/NodeJSInstallerTest.java
            src/test/java/jenkins/plugins/nodejs/NpmrcFileSupplyTest.java
            src/test/java/jenkins/plugins/nodejs/SimpleNodeJSCommandInterpreterTest.java
            src/test/java/jenkins/plugins/nodejs/VerifyEnvVariableBuilder.java
            src/test/java/jenkins/plugins/nodejs/tools/NodeJSInstallationMockitoTest.java
            http://jenkins-ci.org/commit/nodejs-plugin/4a60c2fb1c90ed87d05a61febe149999515afdab
            Log:
            Finish JENKINS-41947

            Compare: https://github.com/jenkinsci/nodejs-plugin/compare/f0b500baeaa7...4a60c2fb1c90

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nikolas Falco Path: src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java src/main/java/jenkins/plugins/nodejs/NodeJSConstants.java src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java src/test/java/jenkins/plugins/nodejs/CIBuilderHelper.java src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java src/test/java/jenkins/plugins/nodejs/NodeJSInstallerTest.java src/test/java/jenkins/plugins/nodejs/NpmrcFileSupplyTest.java src/test/java/jenkins/plugins/nodejs/SimpleNodeJSCommandInterpreterTest.java src/test/java/jenkins/plugins/nodejs/VerifyEnvVariableBuilder.java src/test/java/jenkins/plugins/nodejs/tools/NodeJSInstallationMockitoTest.java http://jenkins-ci.org/commit/nodejs-plugin/4a60c2fb1c90ed87d05a61febe149999515afdab Log: Finish JENKINS-41947 Compare: https://github.com/jenkinsci/nodejs-plugin/compare/f0b500baeaa7...4a60c2fb1c90
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Nikolas Falco
            Path:
            src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java
            src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java
            src/main/java/jenkins/plugins/nodejs/NodeJSConstants.java
            src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java
            src/test/java/jenkins/plugins/nodejs/CIBuilderHelper.java
            src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java
            src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java
            src/test/java/jenkins/plugins/nodejs/NodeJSInstallerTest.java
            src/test/java/jenkins/plugins/nodejs/NpmrcFileSupplyTest.java
            src/test/java/jenkins/plugins/nodejs/SimpleNodeJSCommandInterpreterTest.java
            src/test/java/jenkins/plugins/nodejs/VerifyEnvVariableBuilder.java
            src/test/java/jenkins/plugins/nodejs/tools/NodeJSInstallationMockitoTest.java
            http://jenkins-ci.org/commit/nodejs-plugin/5050b8d68327911f0615a0ace88f86984b9dc2d3
            Log:
            [FIX JENKINS-41947]

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nikolas Falco Path: src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java src/main/java/jenkins/plugins/nodejs/NodeJSCommandInterpreter.java src/main/java/jenkins/plugins/nodejs/NodeJSConstants.java src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java src/test/java/jenkins/plugins/nodejs/CIBuilderHelper.java src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java src/test/java/jenkins/plugins/nodejs/NodeJSInstallerTest.java src/test/java/jenkins/plugins/nodejs/NpmrcFileSupplyTest.java src/test/java/jenkins/plugins/nodejs/SimpleNodeJSCommandInterpreterTest.java src/test/java/jenkins/plugins/nodejs/VerifyEnvVariableBuilder.java src/test/java/jenkins/plugins/nodejs/tools/NodeJSInstallationMockitoTest.java http://jenkins-ci.org/commit/nodejs-plugin/5050b8d68327911f0615a0ace88f86984b9dc2d3 Log: [FIX JENKINS-41947]

              People

              • Assignee:
                nfalco Nikolas Falco
                Reporter:
                catufunwa Chima Atufunwa
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: