Jenkins add permission for composer - jenkins

I have few projects in Jenkins, but I have problem with build this projects.
Everytime Jenkins throw exception :
rename(/var/lib/jenkins/.composer/cache/composer-temp.phar,/usr/local/bin/composer):
Permission denied
When I add permission chmod -R 777 /usr/local/bin/composer, then work but for one project. When I try build next project, Jenkins throw this exception.
Jenkins is in sudoers.
What do I need to Jenkins had the permission?

Related

Jenkins Permission Denied on shell execute

I'm trying to do a shell execute in Jenkins build step. I have a binary executable in /home/ubuntu/.local/bin/aws which is called from Jenkins executable script.
In the build output log, it reads /tmp/jenkins2312.sh: line 2: /home/ubuntu/.local/bin/aws: Permission denied
Adding Jenkins user to Root Group didn't help.
Give execute permission to aws file.
chmod +x /home/ubuntu/.local/bin/aws
Is the file executable for jenkins?
If you are on the machine you could set it to have suitable executable permissions (chmod 755 /home/ubuntu/.local/bin/aws )
You should only have to do this once.
In Ubuntu you need to stop and start Jenkins after you change jenkins's user's permissions. For me, restarting Jenkins didn't work but stop and start did.
your aws executable should in this location
/usr/local/bin/aws
then should work as you want, I don't think on .local

Jenkins and CMake: permission errors

I installed Jenkins, I'm new to it. Made a user, installed the CMake plugin. I'm trying to compile a simple project just to get started but I cannot even do that.
After complaining of not being able to open some files (like build/CMakeFiles/CMakeOutput.log), at the end of the output it says:
-- Configuring incomplete, errors occurred!
CMake Error: Cannot open file for write: /home/username/development/csa/build/CMakeCache.txt.tmp
CMake Error: : System Error: Permission denied
CMake Error: Unable to open cache file for save. /home/username/development/csa/build/CMakeCache.txt
CMake Error: : System Error: Permission denied
Build step 'CMake Build' marked build as failure
Finished: FAILURE
To me this is clearly a permissions issue. The build directory is empty, it has not done anything. I created a user, started jenkins and either of the following had no effect on the output:
sudo /etc/init.d/jenkins start --user jenkins
sudo /etc/init.d/jenkins start --user username
sudo /etc/init.d/jenkins start
I'm not even trying to compile the code, just trying to build the cmake files... my configuration is like this: (as simple as possible)
I did add a working directory which is in my home folder so I do have permissions for it.
EDIT: I changed the ownership of the build folder to jenkins, created a user group called jenkinsusers, added myself and jenkins to the group, and gave the group read/write permissions. It appears to work now. But I'm not sure this is the standard way to do this...
So I'm not sure this is the right way but this is how I did it: I changed the owner of the directory to jenkins.
The workspace folder is under my home directory (~/myproject/build). That's probably the issue. The compiling gets done using catkin_make, a tool from ROS.

Config Jenkins Workspace Root Directory

I created new project and using Jenkins to build it.
So, everything is ok if I put the project in directory belongs to Jenkins user.
My config for Workspace Root Directory is:
${ITEM_ROOTDIR}/workspace
Home Jenkins user is
/Users/Shared/Jenkins/Home
However, if I change this config to use new workspace under other user home directory (in my case is /Users/apple), I receive this error:
Started by user anonymous
Building in workspace /Users/apple/Desktop/JenkinsJobs
java.io.IOException: Failed to mkdirs: /Users/apple/Desktop/JenkinsJobs
at hudson.FilePath.mkdirs(FilePath.java:1164)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1268)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
I also tried config to this path, but it also no lucky:
${ITEM_ROOTDIR}/../../../../../../apple/Desktop/JenkinsJobs
So, how can I config to use with another checkout source directory?
Example, I checkout my source to this folder:
/Users/apple/Desktop/JenkinsJobs
and I want to use this folder as workspace, how I do it?
Thanks in advance.
We can actually see the error is with permissions:
Failed to mkdirs: /Users/apple/Desktop/JenkinsJobs
The job is failing to create the folder structure on the given location.
Your options:
Pre-create the folders and grant access to the service running the job:
sudo mkdir /Users/apple/Desktop/JenkinsJobs
(given Jenkins uses account 'jenkins') sudo chown -R jenkins:jenkins /Users/apple/Desktop/JenkinsJobs
Use a different location for your workspace which is not restricted like a user profile.

Jenkins_Execution of gradle script throws a permission denied error

In jenkins iam facing an error when i trigger the gradle task.
When i execute the below shell
cd /home/cucumberBdd
./gradlew cucumber
I got this error ".gradle/1.8/taskArtifacts/cache.properties.lock (Permission denied)"
Below are the configurations:
Os-Ubuntu
CI-Jenkins
Buildtool:Gradle
Script: gradle script
I have installed and mentioned the gradle version in the manage jenkins.
One thing which i noticed is in jenkins the above command + whoam i gives jenkins name but the project folder writes are with system user.Can anyone tell me please how to avoid this error
You should not put .gradle in the version control at all, only the gradle directory (without the dot) needs to be versioned. Everything in .gradle is just caching stuff and can be safely deleted and recreated.

Jenkins building Xcode - getting build error "permission denied"

I'm trying to get a phonegap project building on our Jenkins build server and I'm getting a permission denied error. Keep in mind, this is my first experience with Mac OS X.
The build output in Jenkins is telling me this:
/bin/sh -c \"/Users/Shared/Jenkins/Home/jobs/myMobile\ -\ iOS/workspace/build/TDE.build/Release-iphoneos/TDE.build/Script-304B58A110DAC018002A0835.sh\"
/Users/Shared/Jenkins/Home/jobs/myMobile - iOS/workspace/build/TDE.build/Release-iphoneos/TDE.build/Script-304B58A110DAC018002A0835.sh: line 2: cordova/lib/copy-www-build-step.sh: Permission denied
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Copy\ www\ directory build/TDE.build/Release-iphoneos/TDE.build/Script-304B58A110DAC018002A0835.sh
(1 failure)
Build step 'XCode' marked build as failure
Finished: FAILURE
Googling this, I found a SO post saying to run the chmod 755 command on this .sh file, but that still didn't fix anything. What else should I be doing to get this file to be able to execute/copy or whatever it's doing?
Edit: Is my actual permission issue for this file:
line 2: cordova/lib/copy-www-build-step.sh: Permission denied
Or is it the Script-.... file?
Added permissions on the ...copy-www-build-step.sh file and that fixed THIS build error. On to the next...
In order for these permissions to stay even after doing a full-checkout from SVN via Jenkins, find the copy-www-build-step in your source control. View the properties for the file, and add svn:executable.
This fixes it so you don't have to keep updating the permissions if you do a full checkout for every build.
I get the answer... I have to change the file permissions.. sudo chmod 777 copy-www-build-step.sh
just move to the platforms/ios/cordova/lib and execute the above command.

Resources