Published July 29, 2018 by

Install Blue Ocean Plugin in Jenkins

A Blue Ocean is a new user experience for Jenkins and provides an interactive view for Jenkins Pipeline and jobs. it reduces the clutter and increases the clarity.

Blue Ocean is simple to install and will work on basically any Jenkins 2 instance (version 2.7 or later). Even better, it runs side-by-side with the existing Jenkins web UI - you can switch back and forth between them whenever you like. There’s really no risk.

Install Blue Ocean

1. Login to your Jenkins server

2. Click Manage Jenkins in the sidebar then Manage Plugins


3. Choose the Available tab and use the search bar to find Blue Ocean.
4. Click the checkbox in the Install column.
5. Click either Install without restart or Download now and install after restart.

After you install Blue Ocean, you can start using it by clicking on Open Blue Ocean in the Side Bar of the Jenkins web UI.

Alternatively, you can access Blue Ocean directly by appending /blue to the end of your Jenkins server’s URL - e.g. http://jenkins-server-url/blue

Switching to the classic UI

Blue Ocean does not support some legacy or administrative features of Jenkins that are necessary for some users.

If you need to leave the Blue Ocean user experience to access these features, click the Go to the classic icon at the top of a common section of Blue Ocean’s navigation bar.

Clicking this button takes you to the equivalent page in the Jenkins classic UI or the most relevant classic UI page that parallels the current page in Blue Ocean.
Read More
Published July 08, 2018 by

Jenkins Interview Questions


What is Jenkins?
Jenkins is an open source tool with plugin built for continuous integration purpose.  The principal functionality of Jenkins is to keep a track of version control system and to initiate and monitor a build system if changes occur. It monitors the whole process and provides reports and notifications to alert.

What is Continuous Integration (CI)?
In software development, when multiple developers or teams are working on different segments of the same web application, we need to perform integration test by integrating all modules.  In order to do that an automated process for each piece of code is performed on a daily bases so that all your code gets tested.

What are the CI Tools?

  • Jenkins
  • TeamCity
  • Travis CI
  • Go CD
  • Bamboo
  • GitLab CI
  • CircleCI
  • Codeship

What is the programming language used to build Jenkins?
Jenkins is an open source automation server written in Java.

What is the requirement for using Jenkins?

  • A source code repository which is accessible, for instance, a Git repository
  • A working build script, e.g., a Maven script, checked into the repository

What are the features of Jenkins?
Continuous Integration and Continuous Delivery - As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.

Easy installation - Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Mac OS X, and other Unix-like operating systems.

Easy configuration - Jenkins can be easily set up and configured via its web interface, which includes on-the-fly error checks and built-in help.

Plugins - With hundreds of plugins in the Update Center, Jenkins integrates with practically every tool in the continuous integration and continuous delivery toolchain.

Extensible - Jenkins can be extended via its plugin architecture, providing nearly infinite possibilities for what Jenkins can do.

Distributed - Jenkins can easily distribute work across multiple machines, helping drive builds, tests and deployments across multiple platforms faster.

What are the advantages of Jenkins?

  • At integration stage, build failures are cached
  • For each code commit changes an automatic build report notification generates
  • To notify developers about build report success or failure, it is integrated with LDAP mail server
  • Achieves continuous integration agile development and test-driven development
  • With simple steps, maven release project is automated
  • Easy tracking of bugs at early stage in development environment than production

How you can move or copy Jenkins from one server to another?
Slide a job from one installation of Jenkins to another by copying the related job directory
Make a copy of an already existing job by making a clone of a job directory by a different name. Renaming an existing job by renaming a directory.

Some of the useful plugins in Jenkins?

  • Maven 2 project
  • Amazon EC2
  • HTML publisher
  • Copy artifact
  • Join
  • Green Balls

How you can deploy a custom build of a core plugin?

  • Stop Jenkins
  • Copy the custom HPI to $Jenkins_Home/plugins
  • Delete the previously expanded plugin directory
  • Make an empty file called <plugin>.hpi.pinned
  • Start Jenkins

How can create a backup and copy files in Jenkins?
Jenkins saves all the setting, build artifacts and logs in its home directory, to create a back-up of your Jenkins setup, just copy this directory. You can also copy a job directory to clone or replicate a job or rename the directory.

How you can set up Jenkins job?
To create a project that is handled via jobs in Jenkins.  Select a New item from the menu, once this done to enter a name for the job and select a freestyle job. Then click OK to create a new job in Jenkins.  The next page enables you to configure your job.

What is a Jenkins Pipeline?
Jenkins Pipeline (or simply "Pipeline") is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.

What is a Continuous delivery pipeline?
A continuous delivery pipeline is an automated expression of your process for getting software from version control right through to your users and customers.

What is Jenkinsfile and what it does?
The definition of a Jenkins Pipeline is typically written into a text file called a Jenkinsfile which in turn is checked into a project’s source control repository.

What is the difference between Poll SCM & Build Periodically in Jenkins?
The primary difference between triggering a build periodically and poll SCM is, with Trigger Builds Periodically will trigger builds as per the schedule (i.e. every 10 minutes) even if you haven't changed anything. Poll SCM will check for changes before triggering any build, if there are changes to the previous version there only build will be triggered.

What are the two components Jenkins is mainly integrated with?

  • Version Control system like GIT, SVN
  • And build tools like Apache Maven.

How will you secure Jenkins?

  • Ensure global security is on.
  • Ensure that Jenkins is integrated with my company’s user directory with the appropriate plugin.
  • Ensure that the matrix/Project matrix is enabled to fine tune access.
  • Automate the process of setting rights/privileges in Jenkins with a custom version controlled script.
  • Limit physical access to Jenkins data/folders.
  • Periodically run security audits on same.

What is the relation between Hudson and Jenkins?
Hudson was the earlier name and version of current Jenkins. After some issue, the project name was changed from Hudson to Jenkins.

What you do when you see a broken build for your project in Jenkins?
I will open the console output for the broken build and try to see if any file changes were missed. If I am unable to find the issue that way, then I will clean and update my local workspace to replicate the problem on my local and try to solve it.

What are the various ways in which build can be scheduled in Jenkins?

  • By source code management commits
  • After completion of other builds
  • Can be scheduled to run at a specified time
  • Manual Build Requests

What is the difference between Maven, Ant, and Jenkins?
Maven and Ant are Build Technologies whereas Jenkins is a continuous integration tool.

Which SCM tools Jenkins supports?

  • Subversion
  • Git
  • Mercurial
  • AccuRev
  • CVS
  • Perforce
  • Clearcase
  • RTC

What is Blue Ocean in Jenkins?
Blue Ocean is a project that rethinks the user experience of Jenkins, modeling and presenting the process of software delivery by surfacing information that’s important to development teams with as few clicks as possible, while still staying true to the extensibility that is core to Jenkins.
Read More
Published July 01, 2018 by

Install Jenkins on Tomcat in Windows or Linux

CI or Continuous integration is being adopted at a very high pace to streamline the build time & testing. To implement the CI, there are many tools available but the Jenkins lead the pack.

In this tutorial, we will learn to install Jenkins on Tomcat server.

Pre-requisites

1- We need to have Java installed on our machine. install java on CentOS/RHEL & on Ubuntu.

2- We will also to have Apache Tomcat installed on our system. Install Tomcat.


Install Jenkins on Tomcat

Now that we have all completed the above-mentioned steps, we will now download the 'jenkins.war' file from the official Jenkins Web page. Execute the following command from a terminal to download the 'jenkins.war'

# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war

Now we need to copy this file to webapps directory located in Tomcat home. So if you have tomcat installed in opt directory, then run the following command.

# cp -rv jenkins.war /opt/tomcat/webapps

With this step, a process to install Jenkins on tomcat is now complete. All we have to do is to start the tomcat server. Start the tomcat server.

# sh /opt/tomcat/bin/startup.sh

After the server has been started, check if the Jenkins is working by visiting the following URL from the browser.

http://server_ip:8080/jenkins

We will have to configure the Jenkins server now. As mentioned on the webpage, we can find the admin password from location /root/.jenkins/secrets/initialAdminPassword. Get the password with the following command.

# cat /root/.jenkins/secrets/initialAdminPassword


Copy it to the webpage and press Continue.

Here it asks for install plugins please select whatever you want. 

Now complete the setup by filling out the required details. After the setup is complete, we can access jenkins and can also create new jobs on the jenkins server.

Read More