I have a Jenkins server with a good number of jobs. Recently, I decided to implement slave servers to reduce the server load. Everything went fine until I had this new requirement. Almost all of the java jobs are compiled with OpenJDK 7. Now there are some new projects requiring to be compiled with open jdk 8 and sun jdk 7 and 8. I decided to install new slaves with openjdk 8 and sun jdk 7 and 8 (three separate slaves) and assign those jobs with those requirements using the 'Restrict where this job can be run'option. However, how can I prevent the existing jobs from getting compiled in the new slaves (i.e. I want them to be compiled on the slaves with openjdk 7)?
Master Jenkins is 1.598 running on Redhat 6.5.
Thanks
I found the answer myself. The slave jar, as found in this page, takes two arguments - mode and label. I start those slaves where the jobs to be prevented from running, with an 'exclusive' mode (and a specific label). On the master side I assigned those jobs for those slaves using the 'Restricted to <label>' option. Normal slaves run with a 'normal' mode where any un-restricted jobs can be run. Please let me know if the answer(and/or the question/requirement) is not clear.
You can use Jenkins labels. Please assigne the following labels to the relevant slave machines: jdk8, sun-jdk7 and sun-jdk8.
Next on your jobs, enable this option: "Restrict where this project can be run"
And select the relevant label.
Related
.If you have 6 jobs can we run some jobs in window slave and some jobs in Linux slave?
Yes, you can run agent nodes on any OS that supports Java. You can also set labels to the slaves and specify this label as the agent when you are creating the pipeline so that the correct job runs on the correct VM. The way you would connect to Linux VMs vs Windows would be different, but after the initial setup, the rest of the steps should be similar.
https://www.jenkins.io/doc/book/managing/nodes/
I'm starting to work with Jenkins , I'm a newbie, and I have a question regarding Master-slave configuration. How's usually used? Is it one slave per application (i.e: 3 applications, 3 slaves)?
PS: If you point me to a good Jenkins tutorial, will be appreciate it
First, my recommendation is to disable all the executors on the master and to build only on slaves.
On our Jenkins platform, we are using 7 CentOS slaves (VM) for the Maven builds (one executor per node).
These slaves have the same Jenkins label ("build linux" for example).
All the Maven projects are restricted to this "build linux" label:
https://serverfault.com/questions/359793/tell-jenkins-to-run-a-specific-project-on-a-particular-slave-node
We also have dedicated slaves per platform (Linux 32bits, Linux 64bits, AIX 6, AIX 7, Windows 2008 R2, Windows 2012).
If you need to deploy your applications on dedicated Application Servers (Tomcat, Weblogic, ...), you can create one slave per platform.
Using Jenkins label is really useful to distribute your builds on the relevant slaves.
First recommendation is to use at least one slave and not use the master for building.
Read https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds (first answer when googling "jenkins master slave tutorial").
Then, add as much slaves as you want to distribute the load. The load does not directly depends on the number of "applications" but on the number of simultaneous builds and available slaves to perform those builds (you may have multiple jobs for a unique application). Typically, you will add slaves if your builds are "pending" for too much time: see https://wiki.jenkins-ci.org/display/JENKINS/Executor+Starvation
Tie the jobs to labels rather than directly to the slaves.
You will obviously have different slaves per build environment.
If your build is isolated enough and it is not multi-threaded, then it is also recommended to set about as much executors as core CPU. That is to make use of the slave resources; another solution is to use virtualization, containers (VM, docker...) as slaves with one executor per slave.
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'm new to Jenkins and Continous Integration, and I noticed that it supports master / slave nodes. I really don't know what that means.
Can someone please tell in what scenario do I need slave agent?
Here is a scenario:
Our main Jenkins master is running on Windows machine (yes I know... I know...). We are doing iOS mobile development. There are some things that can only be done using Xcode (which only runs on Mac OS). I have a Jenkins Slave running on that Mac, that takes care of executing those tasks that can only run on a Mac.
Why not just setup a new instance on that Mac? Cause that job is tied together with other jobs (on Master) in dependencies and the flow. Even promotions on those Xcode tasks are run on Master.
Jenkins' Master / Slave architecture is used to manage distributed builds.
There are many different scenarios you might want to use a distributed build system. It is all based on your projects load and dependencies.
Pretty much, the Master is what you're probably currently using, and is responsible for scheduling builds, dispatching jobs to slaves, and monitoring the results, but can also execute jobs itself. A slave is a java executable that sits on a remote server waiting for instructions from the master (to execute build).
To use this functionality in Jenkins, go to "Manage Jenkins" screen, and click on "Manage Nodes"
https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
For a more in depth summary of distributed builds with Jenkins, as well as some scenarios where this system would be useful, and how to implement it, please read chapter 11: Distributed Builds of Jenkins: The Definitive Guide by John Ferguson Smart
http://wakaleo.com/books/jenkins-the-definitive-guide/download-jtdg-pdf
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.