Build a project remotely but pick the code from local machine through Jenkins - jenkins

I'm running jenkins on my local machine. I need to build and run a project on remote machine as a slave.
I have my project(Java code) in my local machine where the Jenkins is running. So Now when I build the project it looks for the code in my slave machine and says it's not able to find the build.xml in my slave machine.
I want to be able to have Jenkins looks for the code in my local machine and build it in my slave machine and run in the slave machine.
Is that possible? if yes pls help me.

You do not state which version control system you are using? Jenkins has version control plugins for Git, Subversion, etc...
The idea is that you commit and push your changes to your source code repository and the Jenkins slave will automatically pull down the code and compile if anything has changed.

Try the copy artifact plugin. You can create 2 jobs - 1st one to just check out the source code from your repo/version control/workspace. The second job (which runs on the slave restrict where this job can be run inside the job config) can copy those files automatically to the ...remote slave/workspace and then you do whatever you want with them.
This will do what you want, but as Mark O'Çonnor mentions, the idea is you commit the changes to your repository and then the other machine checks it out.

Related

How do I tell Jenkins what to run on my slave machine?

My Jenkins master is up and running. I have created a slave node, launched it successfully from the slave machine, and have done the web services installation so that the connection is established on startup of the slave machine. I have also created a "job" that builds successfully in Jenkins.
How do I tell Jenkins what to actually do on my slave machine? I want to use Jenkins to run an IntelliJ test suite (Selenium and Cucumber) on the slave machine, but haven't been able to figure out exactly how to get it to do this. Note: I've just started looking into the Seleniumhq plug-in, but I'm not sure if this is what I need or not since I'm working with a remote slave.
Limit where the jobs can run using the 'Restrict where this project can be run' to your slave node.
Distributed Builds in Jenkins
My confusion here stemmed from not having my project connected to a VCS repository. Without it, I couldn't figure out how to build-out my project's workspace in the slave environment from Jenkins. I also didn't understand the concept of adding additional build steps at the time I asked this question.
Once I had the VCS connection set-up (I had to do some finagling with Git/Visual Studio Team Services to get it connected, which is why I went with "none" as my version control option at first), my workspace was built for me on the slave machine when I built the project from Jenkins. Then, I used a combination of build steps ("execute Windows batch command" and "Invoke top-level Maven targets") to carry-out the rest of the project's functions.

Can I poll a workspace repository that is located in the slave (Jenkins+RTC plugin)?

I recently started working in a way for speeding up the building time of a relatively big software code base of my company. This code base is using RTC for source code management and after looking and trying I ended using jenkins for automation of the process. I started by creating my build server in a local machine and configure the repository through the RTC plugin, which works quite well using the poll SCM option and with the workspace repository-rtc option. However, I have to move this job to the official jenkins company server, but keeping the job execution in the original local PC. I have added the PC as a jenkins node and I have not had any problem with reaching it through jenkins, but my question/assumptions are the following:
It looks like the job is executing the RTC buildtoolkit from the slave (or at least I had to configured the RTC path in the node.
For some reason, it looks like the polling in jenkins is always looking for the repository in the master, even when I add a SCM pre step in which I can validate that the job is running in the slave system.
My question: Is there any way of ensuring the polling happening in the slave (without scripting or adding external solutions, just using RTC plugin)? For security reason I cannot add additional plugins to jenkins or to create anything in the master, I only got a free job to configure.
Thanks.

How to trigger Jenkins job when a change is made in Server folders?

I want to trigger my Jenkins Job when a particular folder is modified in WAS server.Is there any plugin available ? I tried with 'FSTrigger' plugin but it is working only for local machine folder changes but not for server side changes. I am getting following message in FSTrigger floder log.
Trying to monitor the folder 'https:\server_name\folder_path'
The directory 'https:\server_name\folder_path' doesn't exist.
Kindly help me on this.!!
Regarding this answer:
How to set FSTrigger's folder path in Hudson CI integration tool?
I think you can only monitor a local URL, like:
/var/www/html/test/test1/config
To solve your problem, one solution is to connect your WAS server to your Jenkins master as a Jenkins slave.
And next, create a Jenkins job using the FSTrigger plugin and launch it on your WAS slave.

Jenkins - Copy build log from master to a shared drive

Can someone direct me here? I have a simple job configured in Jenkins on a WINDOWS environment (master and all slaves running on windows) and the job is supposed to run on a particular slave. When you build the job, the build log ( log.log) gets stored in ” %JENKINS_HOME%\jobs\\builds\%BUILD_NUMBER%\” on the master.
I do have a Jenkins workspace (which is required when you add a slave node) set on the slave for this job–where nothing gets stored when the job runs.
With this scenario, I would like to copy the build log (log.log file that’s available on the master) to a share drive. Please advise me the way to get this done. I have tried few plugins “Copy to slave”, “Copy Artifact Plugin” and ArtifactDeployer Plugin…I could not get them working to meet what I need.
Use a second build action with the execute batch option. Put the copy command there to copy the log to another location.
The following command kind-of works:
curl ${BUILD_URL}consoleFull -o ${TargetDir}/Log.txt
where
TargetDir="${WORKSPACE}/Directory/target"
BUILD_URL and WORKSPACE are set by Jenkins. Unfortunately Jenkins doesn't copy the whole log. I've tried consoleText and gotten the same result: partial logs files. :-(

How to setup my remote slave with Jenkins?

In therory Master is : Job and Slave is : Node (however that what im understand).
I installed JENKINS in 2 machines MAC OS X (maybe windows whatever), I set up my job with a correct repository and configure xCode in this job etc ... like same tutorial, i set up my slave etc ... all fine and 10/10 BUTTT this test is local test, in one machine.
My problem is : I want have SLave(Node) for building my xCode Project in MAC OS, and My Matser (job) in others server (why not my seconde machine MAC OS X), How i can establish connection between slave (Node) and Master(job) for building my project xCode in my Remote SLave.
Set your job to use "Restrict where this project can be run" by checking the box and put the name of the slave in the box (use quotes if there are spaces
I had a little trouble deciphering your questions so if this does not answer please rework what you are asking.
Easy set the IP address of the slave host machine in the Jenkins setup. Choose ssh as the communications method and set up accounting information on the slave machines jenkins setup. Make sure the slave machine can ssh to the account and machine you set up in jenkins. Your ready to roll
How to link jobs in Jenkins
Master job: "Trigger/call builds on other projects"
Slave job: Add a Condition Step build: "Run? Build Cause --> UpstreamCause (with The master project name)" and then copy the artifacts (.) from the "Master" job.
Don't forget to copy from the workspace and not from the latest successful build, since the master didn't finished yet and din't publish the artifacts.

Resources