Where does the code pulled down by git jenkins go? - macos

I have a jenkins git job to pull down code from github. Jenkins tells me the job / project is successful. But I can't see the code anywhere on my file system (osx).
Where should it be?

If you used the default location for the JENKINS_HOME directory where Jenkins stores all its data, the code should be under
/Users/jenkins_user/.jenkins/job_name/workspace
where jenkins_user is the account that runs the Jenkins server and job_name s the name of your build job.
Additionally, within the first few lines of the "Console Output" for any build, you should see on which machine and in which directory the build occurred, e.g.
"Building on master in workspace /Users/jenkins_user/.jenkins/job_name/workspace"

Related

Jenkins execute a job from work space instead of SVN path

I want to trigger a Jenkins job for a maven(v3.5.3) project from my local work space folder location instead of configuring SVN Repository URL in the Source code management section. Is there a way to achieve this?. I need to test with code modifications in the project and not wanting to commit the changes, that is the purpose.
I am using Jenkins (v2.161) and it is installed in another machine.
Thanks in Advance.
Although it might look like a sort of tinkering, the source code can be pulled to the Jenknins' host from your local machine, provided that they are properly configured to communicate via ssh.
In the project build configuration on Jenkins' host:
Do not use "Source Code Management" (choose "None").
Check "Delete workspace before build starts", to avoid conflicts with previous changes.
As the very first build step, add "Execute shell" and write a few commands that pull the data, for example:
scp myusername#myhost:/path/to/myworkspace/myproject/src .
scp myusername#myhost:/path/to/myworkspace/myproject/pom.xml .
# etc for all the files/dirs you need to build the project
Then continue with the build steps that were already used for building the project from SCM.

Maven test-output folder is not updated with the build results(emailable-report is not updated after the build is successful/failure with the result)

Scenario: Send an email after the build with the emailable-report.html.
Am able to achieve the above scenario.
But when the build is completed in jenkins, target folder or test-output folder is not updated after build. which means the jenkins workspace is not updating the target folder or test-output folder after the build. Rather the Jenkins workspace remains with the code checked out from GIT repository.
I want the jenkins workspace to be updated after the build to email the latest emailable-report.html.
Script for the sending the email:
def reportPath = build.getWorkspace().child("test-output/emailable-report.html")
msg.setContent(reportPath.readToString(), "text/html")
Help me with this scenario.
This is just because build is generating in wrong jenkins workspace due the wrong configuration that we have done earlier.
It should be something like
C:\Users\Ashv\.jenkins\workspace\projectname
and for this make sure the below configuration.
Goto Manage Jenkins>>Configure System>>Advanced
Home directory C:\Users\Ashv\.jenkins
Workspace Root Directory : ${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}
Build Record Root Directory: ${ITEM_ROOTDIR}/builds
here I am attaching my job screen for all configuration I have done.
you can find the link of image

Jenkins execute shell not able to find gradle commands

I am trying to trigger gradle command in execute shell of a particular node from jenkins master and it's trowing an exception as-
gradle: command not found
Build step 'Execute shell' marked build as failure
However, gradle command works if am trying to execute shell in the same node itself under local workspace.
What I understood-
Triggering any job from remote by default try to search executable like 'adb', 'gradle' in /usr/local/bin of node machine (Macintosh)
read-write access should be there for '.gradle' folder
What I have done-
added .gradle inside /usr/local/bin of slave
granted read-write access to .gradle
Here, both node-jenkins and master-jenkins have gradle v2.5 installed. Why execute shell triggered from master jenkins not able to find gradle in slave jenkins, any help would be appreciated.
try run env before your try to run gradle. and compare it to env from the command line. I think that Jenkins use another path.
I was also facing same issue where gradle command working fine on machine where jenkins is installed but the same command was not working on slave.
Solution:
You need to set GRADLE_HOME on slave.
Most important: set PATH into the slave configuration [copy the exact PATH path from slave machine and copy it into Jenkins slave configuration under Jenkins--> Manage Jenkins--> Manage Node--> NodeName(your node name)--> Configure and search for Node Properties-->Environment variables]
save
In my case I have added additional PATH env variable, then it worked.
I was also facing same issue
verify you add Gradle Plugin to your jenkins
Verify that you inside the Folder where exist the "gradle.build" file
my example: the location of my gradle.build was insifr the foulder automation-api

Change Jenkins job workspace

What I have done :
I have Jenkins set up on my Ubuntu in :
/var/lib/jenkins/
I have a job, that runs every 45 minutes that does a hg pull and hg update --clean default
from my bitbucket repository.So this is running fine.I have a folder
/var/lib/jenkins/jobs/Code Deployement
which contains the latest updated code from my repository.
Problem :
However, I want to access my updated code from
/var/www/html/[project-name]
Query :
Is there anyway i can make jenkins job update this folder instead of the /var/lib/jenkins/Code Deployment folder ? I certainly dont want to make /var/www/html/[project-name] as my jenkins home folder.
How can I achieve what I described above.Will I have to copy the folder from the jobs folder to my desired location after every time the job runs ? Please help me out with the solution,I'am a beginner with automated deployment using Jenkins.
Thank you.
Under "Advanced" you can explicitly choose a working directory for the projects without changing the Jenkins home directory. Check the "Use custom workspace" box and set the directory that Jenkins will pull the code to and build in.
In our setup we wait for the build process to complete in the working directory and add a build step for Jenkins to copy (most) of the files out to the directory that serves up the website. We had issues with file locking preventing the build process if someone (e.g. the testers) were using the site.
One simple way to do it is to create a symlink under /var/www/html/ that points to your code directory, e.g.:
sudo ln -s /var/lib/jenkins/jobs/"Code Deployement" /var/www/html/[project-name]

ld: library not found for -lLIBRARY_NAME, only when trying to build using jenkins

I have a project that when built from my machine everything runs smoothly. However, when I push my changes and try to generate the build using jenkins, I'm getting the library not found error message.
This is weird because if I login into the jenkins server and I try to do a manual build, everything works as expected, perfect. It's only when I build from withing jenkins that my build is failing.
I'm assuming LIBRARY_NAME as the name of whatever library, in my case is an internal static library.
Any suggestions?
EDIT:
I've setup: Library Search Headers, Other Linker Flags, Target Dependencies, Proper Architectures
I wrestled with this for three weeks until I accidentally stumbled onto this with the help of a coworker. Basically, you must be sure that the path structure created in your repository is replicated in the .jenkins workspace. To do this just be sure that in your project/job configuration in jenkins the Source Code Management > Subversion > Repository URL field must be at the same level as specified in jenkins in your script or Build > Execute Shell > Command field. So here are my settings as an example:
above Jenkins URL = https://myDuncwa.local/duncwa-repo
above Jenkins Build = "cd $WORKSPACE/mobileapps/projects/PictureBoard/trunk/PictureBoard" and line 2 "xcodebuild -project PictureBoard.xcodeproj" no quotes.
above Subversion URL repository = https://myDuncwa.local/duncwa-repo
This will cause the directory structure mobileapps/projects/PictureBoard in my repository to replicated in the .jenkins/jobs/PictureBoard/workspace/mobileapps/projects/PictureBoard directory that is created automatically by jenkins. Note: 1) This will copy the entire repository so be prepared to change this later and 2) .jenkins is a hidden directory created by the install in the installing user's home directory or "~/"

Resources