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

Permission issue when using "Extract *.zip/*.tar.gz" installer

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: nodejs-plugin
    • Labels:
      None
    • Environment:
      Jenkins:2.60.2
      NodeJS:1.2.2
    • Similar Issues:

      Description

      Issue

      When using the automatic installer of type "Extract .zip/.tar.gz" for NodeJS ( see tool-config.png) and use it in the NodeSJ script step in a freestyle job (see job-config.png), this results in a Permission Denied exception:

      Started by user admin
      Building in workspace /tmp/je-1-home/workspace/testFreestyle
      Unpacking https://nodejs.org/dist/v6.11.1/node-v6.11.1-linux-x64.tar.gz to /tmp/je-1-home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node-001 on Jenkins
      [testFreestyle] $ /var/folders/m7/lghwdpdx70d6454dsp825bxc0000gn/T/hudson7136647660096639963.js
      FATAL: command execution failed
      java.io.IOException: Cannot run program "/var/folders/m7/lghwdpdx70d6454dsp825bxc0000gn/T/hudson7136647660096639963.js" (in directory "/tmp/je-1-home/workspace/testFreestyle"): error=13, Permission denied
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      	at hudson.Proc$LocalProc.<init>(Proc.java:245)
      	at hudson.Proc$LocalProc.<init>(Proc.java:214)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:850)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:384)
      	at hudson.Launcher$ProcStarter.join(Launcher.java:395)
      	at jenkins.plugins.nodejs.NodeJsCommandInterpreter.perform(NodeJsCommandInterpreter.java:84)
      	at jenkins.plugins.nodejs.NodeJsCommandInterpreter.perform(NodeJsCommandInterpreter.java:42)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
      	at hudson.model.Build$BuildExecution.build(Build.java:206)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
      	at hudson.model.Run.execute(Run.java:1735)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:405)
      Caused by: java.io.IOException: error=13, Permission denied
      	at java.lang.UNIXProcess.forkAndExec(Native Method)
      	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
      	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      	... 16 more
      Build step 'Execute NodeJS script' marked build as failure
      Finished: FAILURE
      

      Workaround

      Use the [Custom Tools plugin](https://plugins.jenkins.io/custom-tools-plugin) and a Shell step
      Use Pipeline

        Attachments

        1. job-config.png
          42 kB
          Allan BURDAJEWICZ
        2. tool-config.png
          30 kB
          Allan BURDAJEWICZ

          Activity

          Hide
          nfalco Nikolas Falco added a comment - - edited

          The nodejs installer use the standard Jenkins implementation to download and install zip archive, so a defect should be open to jenkins core component.

          Anyway a fast look I see that the content of the downloaded zip/tar.gz it's into an expected child subdirectory. It is installed into

          /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/test/node-v6.11.1-linux-x64

          instead of

          /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/test/
          Show
          nfalco Nikolas Falco added a comment - - edited The nodejs installer use the standard Jenkins implementation to download and install zip archive, so a defect should be open to jenkins core component. Anyway a fast look I see that the content of the downloaded zip/tar.gz it's into an expected child subdirectory. It is installed into /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/test/node-v6.11.1-linux-x64 instead of /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/test/
          Hide
          nfalco Nikolas Falco added a comment - - edited

          With a debug session I discover that:

          When you use the "Extract zip/tar.gz" action instead of "Install from Node.org", you use some standard tool provided by the Jenkins Core. The issue you got is because the archive you provide must contains the tool content directly in the root and nested in any sub folder. This is reasonable because the generic "Extract zip/tar.gz" action could not knows nothing about its content.

          To resolve your issue provide a correct nodejs archive for the action you choose without the node-v6.11.1-linux-x64 folder.

          Since the archive url you are using it's an official NodeJS distribution why you do not use the action "Install from NodeJS"?

          Show
          nfalco Nikolas Falco added a comment - - edited With a debug session I discover that: When you use the "Extract zip/tar.gz" action instead of "Install from Node.org", you use some standard tool provided by the Jenkins Core. The issue you got is because the archive you provide must contains the tool content directly in the root and nested in any sub folder. This is reasonable because the generic "Extract zip/tar.gz" action could not knows nothing about its content. To resolve your issue provide a correct nodejs archive for the action you choose without the node-v6.11.1-linux-x64 folder. Since the archive url you are using it's an official NodeJS distribution why you do not use the action "Install from NodeJS"?
          Hide
          nfalco Nikolas Falco added a comment -

          I will add a check if the exeutable exists as in Maven before proceed with the step.

          Show
          nfalco Nikolas Falco added a comment - I will add a check if the exeutable exists as in Maven before proceed with the step.
          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/resources/jenkins/plugins/nodejs/Messages.properties
          src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java
          src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java
          http://jenkins-ci.org/commit/nodejs-plugin/d2f7a53e8c81b24119b3aa5bdb9aa052367a4ba6
          Log:
          JENKINS-45840 Verify if the NodeJS executable exists before continue with the build step. This improves also the problem determination because avoid the emerge of strange issues.

          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/resources/jenkins/plugins/nodejs/Messages.properties src/test/java/jenkins/plugins/nodejs/NodeJSBuildWrapperTest.java src/test/java/jenkins/plugins/nodejs/NodeJSCommandInterpreterTest.java http://jenkins-ci.org/commit/nodejs-plugin/d2f7a53e8c81b24119b3aa5bdb9aa052367a4ba6 Log: JENKINS-45840 Verify if the NodeJS executable exists before continue with the build step. This improves also the problem determination because avoid the emerge of strange issues.
          Hide
          allan_burdajewicz Allan BURDAJEWICZ added a comment -

          Nikolas Falco Thanks for looking into this.

          I see that the content of the downloaded zip/tar.gz it's into an expected child subdirectory.

          Right, and there is no way to control this in the global config. So maybe you are right, this is an issue in core. The "Permission denied" on a temp *.js file made me think it could be an issue with the NodeJS plugin.

          Show
          allan_burdajewicz Allan BURDAJEWICZ added a comment - Nikolas Falco Thanks for looking into this. I see that the content of the downloaded zip/tar.gz it's into an expected child subdirectory. Right, and there is no way to control this in the global config. So maybe you are right, this is an issue in core. The "Permission denied" on a temp *.js file made me think it could be an issue with the NodeJS plugin.

            People

            • Assignee:
              nfalco Nikolas Falco
              Reporter:
              allan_burdajewicz Allan BURDAJEWICZ
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: