Jenkins Configuration

Jason Taylor
A free video tutorial from Jason Taylor
Lead Software Engineer, Dev Trainer (19 courses,50k reviews)
4.4 instructor rating • 19 courses • 426,019 students

Lecture description

Setting up the basic configuration in Jenkins, such as the number of executors, system message, and attaching all of the tools we will use in this course.

Learn more from the full course

Jenkins 2 Bootcamp: Fully Automate Builds to Deployment 2020

An introduction to the Jenkins build server using continuous integration and deployment techniques -- all step by step.

08:43:20 of on-demand video • Updated May 2020

  • Install Jenkins CI server on Windows
  • Install and configure several tools commonly used with Jenkins
  • Understand the basics of continuous inspection, continuous integration, and continuous deployment
  • Use Jenkins effectively to build, test, analyze and deploy Java projects
  • Apply the techniques and experience to implement Jenkins and/or a continuous integration system
English Welcome, in this video, we're going to continue our Jenkins orientation by setting up our Jenkins configuration. We should be already the main manage Jenkins page. If not navigate there now. From manage Jenkins click on the top item, "Configure System". Right now there isn't a lot here; this page will expand greatly as we add more plugins to our Jenkins server and we will be making occasional trips back to this page accordingly. We can take a quick look around before changing any values. If you want to know about something you can use the question mark icon to expand out some help text. For now there are just two settings we will look at. First we have the number of executers. That refers to the number of concurrent build threads or processes that we can have at the same time, specifically on the master. By default Jenkins sets this value to 2, which, for most systems, is rather low. I recommend setting it to a value somewhere around 1 to 2 times the number of CPU or cores you have available on your system. For example, if you are running on 4 cores consider a setting between 4 to 8. What about hyper-threading or similar technology? Well I still recommend limiting it to two to three times per core. In a four core system with hyper threading you could probably use 8 to 12 executers without too many issues. You will likely need to observe the performance and make adjustments in order to find the right setting for your system. I'm going to stay relatively conservative with 4 executers. Once there are four concurrent builds going on any additional builds will queue up until an executer becomes available. After I set the value to 4 click apply so that we can save the configuration and remain on this page To see the results of the setting change just refresh your browser page. Now the build executers is just expanded to four. The other setting to review is the system message. This places a message at the top of the Jenkins dashboard, which is great when making announcements to your users, like a planned maintenance window on the weekend. Let's try it out: "Planned downtime starting tomorrow at 11 pm and will last for 30 minutes for system updates". Once you have typed in that message click "Save" to save the configuration changes and return to the Jenkins dashboard. There we will see a system message displayed. Now return to the system page in "Manage Jenkins". Once there remove the system message and click save. Now the message is gone. Great. Let's return to "Manage Jenkins". Finally it is time to configure the tools we are going to use with Jenkins. Click on "Global Tool Configuration". Here we will set up or configure Jenkins, Java, and Maven. Let's start with the Java JDK. So under JDK, JDK installations, click on "Add JDK". By default Jenkins is going to have "Install automatically" checked, but we already installed the JDK so I'm going to uncheck install automatically Instead we need to fill in the name, which is any label we want to give this installation of the JDK, as well as the Java home, which is the full path to where Java is currently installed. Since we installed Java and the JDK earlier you should know where that is located. For this I can use a trick; since I know the Maven's version command will give us both the path to the JDK and Maven home I can use one command to get both pieces of information. I'll open up Git bash on Windows or my terminal on Mac OS or Linux and then type "mvn -v", then press enter. The Java home should be displayed, probably to the "jre" beneath the JDK. So only copy the path to the JDK, then return to Jenkins and paste the value into the Java home field. Since this is a Java 8 or JDK 1.8 installation I will give the name "Java 8" in the name field, then click Apply to save the changes so far. Next we have Git. By default Git will be configured to use the Git command. As long as Jenkins has access to the Git command, you won't need to specify the full path. If, for some reason, Jenkins isn't able to reach the Git command you will need to find Git on your system and update the path to the Git executable field to the full path to the Git command. If you install Git, like we covered earlier, you should be fine. Let's continue on with the Maven installation settings. We already have easy access to that information; we're going to be following the same process. Click on "Add Maven". Let's give this Maven installation a name. I'm going to uncheck install automatically and, like before, Maven home is the full path to where we have Maven installed Return to Git bash or your terminal and copy the Maven home value to your clipboard. We're actually done with Git bash or terminal, so exit out. Then return to Jenkins and paste the Maven path into the Maven home field. Since there are no further changes to make I'm going to click on "Save". Great. Now we have returned to manage Jenkins. Since we are done with system configuration and management pages return to the Jenkins dashboard. We just made several changes to our Jenkins system, but we really won't see the benefits of those changes until the next section, where we will set up Maven specific projects in Jenkins.