Jenkins Tutorial – Page 3
Overview of Jenkins UI
High-level Jenkins overview will be provided here:
- Just go to localhost port 8080, type Admin and password there that you have set and log in.
- You will see main section here. There will be no jobs as Jenkins has just installed.
- On the left side, you see menu bar having many menu items, let’s have a look of all of them.
- New Items: Helps to create a new job.
- People: Manages users within Jenkins.
- Build History: Shows history of the builds in the Jenkins
- Manage Jenkins: It provides a high-level overview. It has many items on its management page.
- My Views: Provides the private view that gives an opportunity to every user to have the filter of Jenkins jobs.
- Credentials: Responsible for all the global credentials in Jenkins.
- Build Queue: Shows all the build that has been triggered.
- Build Executor Status: Shows current build executor.
Creation of first Jenkins Job
Let’s create our first job.
Here you need to provide the name of your choice.
Normally it is related to the project you are working on. Avoid spaces here. Suppose the name is first-Jenkins-job. Next, select the type of the project. Currently, it is Freestyle project.
Write project description. It provides overview of the build job on the Home page. Just write this is our first Jenkins job.
Other options in the ‘General’ section are more technically and all are related to the build.
Now comes to ‘Source Code Management’ section. It tells about the source of the code that has been built by the job.
First Jenkins job has no source code. So just leave ‘None’ as default.
Next section is ‘Build triggers’, we can define multiple triggers for this job.
If we don’t specify the triggers then job will only be triggered manually that is fine for our first job.
Now comes to ‘Build’ section where we define actual build steps. Build steps tell Jenkins exactly how we want our project. Select it and click on ‘Execute shell’. Those using window system, please select ‘Execute Windows batch command’.
In ‘Execute shell’, just echo hello Jenkins which will print this message.
Last section is ‘Post-build Actions’. We won’t do any action here. Now, we are done configuring our first job. Just press ‘Save’.
After saving configuration for the first job, let’s go back to go back to dashboard.
New job appears here.
Running first Jenkins Job
We will build the first Jenkins job which we created above and see the results.
We have created our first job so far. Let’s just click the build now button. Then click first Jenkins job to enter name page of the project.
The build we created was scheduled. By clicking on blue ball, it takes us to the main page of this build.
We can see console output of that job by ‘Console Output’. We can see hello Jenkins here.
Click on ‘Back to Project’. Then ‘Back to Dashboard’ on the top left. It takes us to this page.
On the job list, it shows many options (Name, Last success, Last failure, and Last duration). Now, have a look at the columns. One column is of status (Blue ball) and the other one is of weather (Sunshine):
Installation of Git and GitHub plugin
Now, we will set up more practical Maven based build.
We will build a simple Maven project. Since it is a Git project and hosted on GitHub so we need to install Git first. (Note: If you have Git installed then skips these steps)
First, to verify if Git is installed or not, open up command-line terminal:
Otherwise, if you have to install Git, just go the Google and type ‘download Git’. The first entry is the official Git site and leads you to the installation page. Installation steps vary depending upon the operating system you are using. Since we are using Mac, we will click on it.
Download the installer and when it is complete, open it up. Click ‘Continue’ to complete the installation. You can verify it by writing this and checking the version:
Let’s move on to install GitHub Plugin for Jenkins. You can learn more about GitHub plugins by visiting the plugin page:
We are on main page.
Just click ‘Manage Jenkins’.Now click ‘Manage Plugins’.
By clicking this option, you will come to following page, now click ‘Available’.
Go to filter sersch and type ‘github’.
Scroll down and select GitHub then go to ‘install without restart’ option.
Jenkins starts the installation process and install some other plugins too.
Now again click to manage ‘Manage Jenkins’ and click to ‘Manage Plugins’.
This time click on ‘installed’ option.
You can see your ‘GitHub Plugin’ installed.