The application I am looking to build is a distributed system with a server (and several other components) running on a linux machine and a client on the windows machine. At every commit I need to build both the components (linux first and windows next) and run some sanity tests
I installed Jenkins slave on the windows machine, but can't find a plugin which will let me link each build-step in a project to a different machine.
i.e I need to say
Run build-step A on machine M1
Run build-step B on machine M2
Run build-step C on machine M1
Think I can create three different projects for each of these jobs and create a fourth project and have 3 jobs triggering the 3 projects in the required order ("Trigger/call builds on other projects). Is this the only way to do it or is there a plug-in I can use to choose a different machine for each build-step in a project.
Once you have your slaves set up, you can tag them with labels like "windows", "linux", etc. Then you can restrict your jobs to only run on nodes with certain labels.
See Jenkins: The Definitive Guide for more details.
Related
My Jenkins server has multiple slaves with different platforms (Windows, Linux and Mac). I need to run a job in each slave to copy a network folder to each local machine. Here are few questions I have.
Can I create a single project with Batch, bash, Mac bash script and add condition to execute.
Can I create multiple project for each platform and add condition to run depends on the platform.
Is there any use of Multi-configuration project for this situation
What is the best way to achieve this
I would look at using a configuration management tool such as Chef or Puppet, which provides a platform independent DSL to do operations such as copying files. You could then set up a multi-configuration job in Jenkins to run the same job on each of the different slaves.
The simplest way is to create a job in Jenkins that will archive the network folder each time something changes in it, and use the Copy Artifact Plugin to take it to the workspace of each slave wether it is Linux or Windows.
Simple, elegant :)
I would like to raise from scratch a build server for .NET applications using Jenkins, please note that i'm new to Jenkins CI.
Several Questions:
1) How should I decide on the build server specs? except for the OS which would be windows server 2012, how should I decide on the RAM and the CPU and HD space?
2) Should the Jenkins sit in the build machine or not, what is the recommended approach? I understood that the build server should be isolated from the Jenkins master
3) How do I decide on the Master/Slave approach, when should I use only Master and when should I use master and slave or slaves?
4) How would you recommend me to run the build and deployment tasks in the Jenkins CI, using NAnt/Python or any other scripting language ?
10x, and sorry for the igonrance :)
Responding to each in turn:
You can run Jenkins as a windows service (instructions here) and the machine can be a VM, so it doesn't have to be huge.
a) RAM and CPU: I'll put these together and will depend on how many jobs you plan to have running at the same time. The default number of build executors is 3 but can be increased as a global config change.
b) HDD: This depends on how many jobs you plan to have. Jenkins will checkout the source code (as well as the compiled output) to its home directory on a per job basis. This can get big. I would also recommend using the ThinBackup plugin to backup the Jenkins configuration.
Jenkins is the build machine. A vanilla installation of Jenkins is the master. In my experience you will not need a separate slave machine unless you're needing to do native builds on other platforms or have LOTS and LOTS of jobs. I've seen single masters running happily with hundreds of jobs.
Further to 2. above, suggest you start with a master and set up a slave later if you really need one.
As you have stated you are building .NET applications, you can simply install the MSBuild plugin which should serve you well. Builds for .NET applications in Jenkins are Freestyle builds so you will be using Windows Batch build steps often as well. This also is a great blog on Jenkins in a .NET environment.
I want to know if it is possible to run a build on jenkins through another jenkins.
I have two separate jenkins running on two different computers how can I possibly run a build job on one of them from the other ?
If I am building an iphone application and I try to build and deploy it through jenkins, I know I need a mac to develop iphone apps but do I need a jenkins to be running on a mac to build and deploy those applications or can it be running on any computer with any os ?
By the sounds of it you don't need another jenkins instance but a jenkins slave. This is used to build jenkins jobs on other platforms.
I have slave that run on WinXP, Win7 32bit, Win7 64bit and Ubuntu. However my jenkins instance runs on Ubuntu (not the same as the slave). This way jobs can be created with specific labels that will correspond to labels on the slaves.
Example:
job 1, label: ios
job 2, label: winxp
jenkins master: label ubuntu
jenkins slave1: label ios
jenkins slave2: label winxp
This way job 1 will only run on slave 1 and job 2 will only run on slave2 and you don't need to do anything about it.
Travis CI has a really nice feature, builds are run within VirtualBox VMs. Each time a build is started, the box is refreshed from a snapshot and the code copied on to it. Any problems with the build cannot affect the host, and you can use any OS to run your builds on.
This would be really good, for example, compiling and testing code on a guest OS that matches your production env. Also, you can keep your host free of any installation dependencies you might need (e.g. a database server) and run ITs without worrying about things like port conflicts.
Does such a thing exist for Jenkins?
Check out the Vagrant Plugin https://wiki.jenkins-ci.org/display/JENKINS/Vagrant-plugin
This plugin allows booting of Vagrant virtual machines, provisioning them and also executing scripts inside of them
You can run Jenkins in a Master Slave Setup. Your Master instance manages all the jobs but lets all the slaves do the actual work. These Slaves can be VMs or physical machines. Go To Manage Jenkins -> Manage Nodes -> New Node to add Nodes to your Jenkins Setup.
There is the vSphere Cloud Plugin and the Scripted Cloud Plugin that can be used for this purpose.
I am using Jenkins for CI,
I've heard that I should have a dedicated server and slave for running Jenkins and building tasks, respectively -
is this true?
I can understand this as the server may not be powerful enough to handle the server itself and running build tasks,
but is there any defined technical reason for this?
Best practice is to have a separate machine for Jenkins-Server,
and not to use it for builds at all.
This has nothing to do with CPU-power or memory-resources -
A build-machine should have a predefined configuration,
and Jenkins should not be part of it.
(Jenkins requirements may even conflict with those of the build-machine)
You should be able to boot / clone / upgrade / restore / trash the build-machine
without any impact on Jenkins.
Of course you can settle for a single machine, if your resources are limited,
but if you are serious about build-automation - Jenkins should have its own server.
You probably don't need dedicated hardware/VM to run a Jenkins server because the actual Jenkins process (no builds running) uses very little resources. But it all depends on what you want to accomplish with your Jenkins setup.
Do you want to run continuous builds across multiple platforms for multiple projects? Then using a master with slaves is the only way to go. If, on the other hand, you're running fairly simple builds for just a few projects, then you only need one machine to run the builds and the Jenkins process.
You can configure Jenkins to have multiple builds running concurrently so if you have a quad-core machine, you can safely run 2 builds and possibly a third once you analyze resource usage.
At my last gig, I used a quad-core machine with 8GB RAM to run:
Jenkins running Selenium builds
VirtualBox VM with Windows XP
Two instances of Tomcat each with two applications deployed.
And the machine still had more to spare.