I'm getting:
[[1;31mERROR[m] Failed to execute goal [32morg.apache.maven.plugins:maven-compiler-plugin:3.1:compile[m [1m(default-compile)[m on project [36mtest[m: [1;31mError while storing the mojo status[m: /var/lib/jenkins/workspace/e2e-tests/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied) -> [1m[Help 1][m
in an "Execute Shell" script (mvn test) in a Jenkins job.
I see that the /var/lib/jenkins/workspace folder has "drwxr-x--- 3 jenkins jenkins" permission. If I get it right, only jenkins user can write in this folder. However if I put "who" in the shell script, I see that the job is executed as root (even though in /etc/default/jenkins I see JENKINS_USER=jenkins).
To resolve the 'permission denied' problem I did:
chmod -R 777 /var/lib/jenkins/workspace
Is this the proper solution? Is it normal for the job to be run as root and not jenkins?
Thanks,
Dinko
I reverted the permissions on the /var/lib/jenkins/workspace back to drwxr-x---, rebooted the Jenkins host and restarted the job. No "Permission Denied" error was logged anymore.
Rebooting the host did solve the issue.
Related
I'm running jenkins pipeline on a slave computer (slave run from agent command line - user with full admin privileges).
when trying to run a tool from system32 folder, it failes: The system cannot find the path specified.
if I copy the tool to c:\myfolder, it succeeds.
I've also tried to run msbuild - fails on post build regsvr32. but, when running the same command via computer's command line (not jenkins), it succeeds.
It looks like I have a problem with permissions but I do not know what is wrong. jenkins is running via command line with a user that have administrator permissions.
any ideas?
I'm getting this permission denied error when I'm trying to execute a liquibase command as a shell command.
/tmp/jenkins976.sh: line 3: /home/ec2-user/liquibase/liquibase: Permission denied
I've given the necessary permissions to the liquibase executable.
This worked fine with a previous version of jenkins and started getting this error after upgrading jenkins.
Current Jenkins version: 2.168
Appreciate any help to resolve this issue.
I have a "docker-jenkins" container with some configured tasks that in the post-build have to run a shell script that move the builded data to a new folder inside the container and then commit to SVN repo.
My problem is that the SH script is executed by "jenkins" user that has not root privileges so my script fails with "permission denied" error.
How can I grant more privileges to jenkins user? Or how can I run the SH script with root privileges?
I'm using Jenkins CI inside a docker container so I suppose that I have to run some docker commands to grant more privileges to jenkins user...
Any ideas?
I'm trying to build Apache NiFi after cloning it from https://github.com/apache/nifi and it keeps failing on the tests on the nifi-standard-processors project. I opened up the output file in the surefire-reports directory and there's the below error that it can't run program "cmd" in directory /var/test, because no such file or directory exists. The first time I ran the install it didn't exist, but I created it and I still get the error message. I do a sanity check every time to make sure the directory still does exist. Does anyone have any idea what might be causing this issue? I'm only taking a very few steps to do this. They are posted below. I'm logged on as root on a CentOS Linux VM. Thanks in advance for any help.
Steps:
cd /tmp
git clone https://github.com/apache/nifi
cd nifi
mvn clean install
[main] ERROR org.apache.nifi.processors.standard.ExecuteProcess - ExecuteProcess[id=a8d6b3a3-befa-4b74-a962-330bd021ec7b] Failed to create process due to java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory: java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory
I believe this is due to a recent commit "solving" this ticket[1]. I actually already reopened[2] it due to failures on TravisCI and the contributor is currently working on a fix.
In order to build now, you can tell maven to "skip tests" by running the command with the proper flag: mvn clean install -Dmaven.test.skip=true
[1] https://issues.apache.org/jira/browse/NIFI-2905
[2] https://issues.apache.org/jira/browse/NIFI-2905?focusedCommentId=15603258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15603258
I have few shell commands that needs to be executed when a build is getting ready. In Jenkins, I have created a Freestyle project with execute shell options as:
#!/bin/sh
cd /path to kafka folder
bin/zookeeper-server-start.sh config/zookeeper.properties &
bin/kafka-server-start.sh config/server.properties &
cd /path to elasticsearch
bin/elasticsearch
I am able to execute this shell commands from a local file but not through Jenkins.
Here is the Console output I am seeing in Jenkins:
/Users/Shared/Jenkins/tmp/hudson2342342342342357656.sh: line 2: cd: /path to kafka folder: Not a directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any help on how I can fix this? Thanks.
It is a permission issue. Please check your Jenkins user has enough permission to run this shell commands
The best way to find out what's wrong (e.g. permissions issue; folder doesn't exist; etc), do this:
Log into the slave node that is executing this job (if there is none defined, it's probably the Jenkins server itself ("master")
If on "master": become the user that Jenkins runs as (most likely 'jenkins'): sudo su - jenkins (if you have sudo/root access), or su - jenkins (if you know jenkins's password)
If the job runs on another slave, find out as which user the Jenkins server connects. Become that user on the slave node.
cd /path/to/workspace (you can find the job's workspace by looking at the console of a job run)
Now run your commands from a shell as they are in the build step - it may become more apparent on why they fail.