Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins & NodeJS plugin - Permission Denied error

I've managed to setup a Jenkins instance on a Raspberry Pi, and have got as far as installing the NodeJS plugin before I eventually hit this stumbling block:

Started by an SCM change
Building in workspace /var/lib/jenkins/jobs/Test Project/workspace
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url localhost:/GITREPO/test # timeout=10
Fetching upstream changes from localhost:/GITREPO/test
 > git --version # timeout=10
 > git fetch --tags --progress localhost:/GITREPO/test +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 8e6edee9fdc1e8bf754dc1a27f46c1dea3531144 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 8e6edee9fdc1e8bf754dc1a27f46c1dea3531144
 > git rev-list 8eaf1bc6a0be837100e476b33bec559b33e9997f # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson5445359267004163031.sh
+ echo /usr/local/bin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
/usr/local/bin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
+ node --version
v0.10.32
+ grunt --version
grunt-cli v0.1.13
+ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)
[workspace] $ /tmp/hudson1009495610900642950.js
FATAL: command execution failed
java.io.IOException: Cannot run program "/tmp/hudson1009495610900642950.js" (in directory "/var/lib/jenkins/jobs/Test Project/workspace"): error=13, Permission denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:802)
    at jenkins.plugins.nodejs.tools.DecoratedLauncher.launch(DecoratedLauncher.java:49)
    at jenkins.plugins.nodejs.tools.NpmPackagesBuildWrapper$2.launch(NpmPackagesBuildWrapper.java:88)
    at hudson.Launcher$ProcStarter.start(Launcher.java:380)
    at hudson.Launcher$ProcStarter.join(Launcher.java:387)
    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:770)
    at hudson.model.Build$BuildExecution.build(Build.java:199)
    at hudson.model.Build$BuildExecution.doRun(Build.java:160)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
    at hudson.model.Run.execute(Run.java:1745)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: error=13, Permission denied
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
    ... 18 more
Build step 'Execute NodeJS script' marked build as failure
Finished: FAILURE

I'm not doing anything particularly special, this is an initial test to ensure the NodeJS plugin works:

var sys = require('sys');
sys.puts('NodeJS Test');
sys.puts('***********');
sys.puts('Hello World');

This works if I log in as the Jenkins user, and run it myself:

jenkins@raspberrypi:~$ node test.js
NodeJS Test
***********
Hello World
jenkins@raspberrypi:~$ 

I've trawled the internet, and cannot seem to find anything specific; pretty sure its not file permissions specifically (Workspace directory has full access to all users)

like image 203
Dualcyclone Avatar asked Oct 07 '14 14:10

Dualcyclone


People also ask

What Jenkins is used for?

Jenkins is an open source continuous integration/continuous delivery and deployment (CI/CD) automation software DevOps tool written in the Java programming language. It is used to implement CI/CD workflows, called pipelines.

Is Jenkins a CI or CD?

Jenkins is a platform for creating a Continuous Integration/Continuous Delivery (CI/CD) environment. The system offers many different tools, languages, and automation tasks to aid in pipeline creation when developing and deploying programs.

What is the difference between GitHub and Jenkins?

Jenkins creates workflows using Declarative Pipelines, which are similar to GitHub Actions workflow files. Jenkins uses stages to run a collection of steps, while GitHub Actions uses jobs to group one or more steps or individual commands. Jenkins and GitHub Actions support container-based builds.

What is Ansible vs Jenkins?

Ansible is a powerful tool for automation to the provision of the target environment and to then deploy the application. Jenkins is a popular tool for IT automation and used for Continuous Integration/Continuous Delivery (CI/CD) to provision the target environment.


1 Answers

I had the same problem. For me it was the nodejs plugin configurations, under "global configurations" in jenkins. My "node" application (symlink) was located at /usr/local/bin/node. And my "installation directory" was set to /usr/local/bin/. I changed that too /usr/local/ and it start working! :)

Note that this is when you aren't using "install automatically"-function of the nodejs plugin.

like image 160
hfm Avatar answered Sep 19 '22 11:09

hfm