DevOps Certification Training
- 83k Enrolled Learners
- Live Class
Just commit changes to the SCR (Source Code Repository) and Jenkins can automate the rest of the process for you with the help of plugins. So that makes it a very important tool in DevOps Certification Training. There is a high possibility that you encounter many Jenkins questions if you go for a DevOps job interview. Below are the most frequently asked Jenkins interview questions. I have collected these questions after doing a lot of research and after discussing with some DevOps experts who are directly involved in the hiring process. Curious to know more about Jenkins check out this Jenkins blog series.
This Jenkins Interview Questions blog is a part of parent blog DevOps Interview Questions. It includes all the DevOps Stages.
In this blog we have covered roughly 50+ questions and we have divided them into 3 categories –
Jenkin is open-source
Bamboo is not open source
Jenkin is completely free
It charges for the number of build agents required
Windows, Ubuntu, Red Hat, Mac OS
Windows, Linux, Solaris
Chrome, Firefox, Internet Explorer
Firefox, Chrome, Safari, Edge
Yes, It supports a lot of plugins
It does not support many plugins as compared to Jenkins
Being open-source, it has a lot of support from communities
It has less support as compared to Jenkins
Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies.
First, a developer commits the code to the source code repository. Meanwhile, the Jenkins server checks the repository at regular intervals for changes.
Soon after a commit occurs, the Jenkins server detects the changes that have occurred in the source code repository. Jenkins will pull those changes and will start preparing a new build.
If the build fails, then the concerned team will be notified.
If the build is successful, then Jenkins deploys the build in the test server.
After testing, Jenkins generates feedback and then notifies the developers about the build and test results.
It will continue to check the source code repository for changes made in the source code and the whole process keeps on repeating.
I will suggest you include the following benefits of Jenkins if you can recall any other benefit apart from the below-mentioned points you can include that as well.
The answer to this is pretty straightforward. To use Jenkins you require:
You can just say Hudson was the earlier name and version of current Jenkins. After some issues, they renamed the project from Hudson to Jenkins.
Below I have mentioned some important Plugins:
These Plugins I feel are the most useful plugins, if you want to include any other Plugin that is not mentioned above, you can add that as well, but make sure you first mention the above-stated plugins and then add your own.
To install Jenkins, you just need to follow these five steps:
Install Java Version 8 – Jenkins is a Java based application, hence Java is a must.
Install Apache Tomcat Version 9 – Tomcat is essential to deploy Jenkins war file.
Download Jenkins war File – This war is must to install Jenkins.
Deploy Jenkins war File – You deploy Jenkins war file using Tomcat to run Jenkins.
Install Suggested Plugins – Install a list of plugins suggested by Jenkins.
Once the installation is complete, you will be able to see the Jenkins dashboard.
According to me, the integration of Jenkins is possible with the following:
If you have anything else in your mind then mention that as well but make sure you include the above two components in your answer.
Maven is a build management tool. It uses a simple pom.xml to configure all the dependencies needed to build, test and run the code. Maven manages the full lifecycle of a test project. Once integrated with Jenkins, the maven Webdriver will build the project and execute all tests efficiently.
For this answer I will suggest you go with the below-mentioned flow:
To start Jenkins manually open Console/Command line, then go to your Jenkins installation directory. Over there you can use the below commands:
Start Jenkins: jenkins.exe start
Stop Jenkins: jenkins.exe stop
Restart Jenkins: jenkins.exe restart
Here are some of the Source Code Management tools supported by Jenkins:
Post is a section that contains several additional steps that might execute after the completion of the pipeline. The execution of all the steps within the condition block depends upon the completion status of the pipeline. The condition block includes the following conditions – changed success, always, failure, unstable and aborted.
Parameters are supported by Agent section and they are used to support various use-cases pipelines. Parameters are defined at the top-level of the pipeline or inside an individual stage directive.
Groovy from Apache is a language designed for the Java platform. It is the native scripting language for Jenkins. Groovy-based plugins enhance Jenkins with great interfaces and build reports that are of dynamic and consistent nature.
If you want to clone a Git repository via Jenkins, you have to enter the e-mail and user name for your Jenkins system. Switch into your job directory and execute the “git config” command for that.
My approach to this answer will be to first mention how to create Jenkins job.
Go to Jenkins top page, select “New Job”, then choose “Build a free-style software project”.
Now you can tell the elements of this freestyle job:
The answer to this question is really direct.
To create a backup all you need to do is to periodically back up your JENKINS_HOME directory. This contains all of your build jobs configurations, your slave node configurations, and your build history. 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.
The way I secure Jenkins is mentioned below if you have any other way to do it than mention that:
Below are the steps to deploy a custom build of a core plugin:
There can be multiple answers to this question I will approach this task in the following way:
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.
If you do it in a different way then just mention that in your answer.
You can schedule a build in Jenkins in the following ways:
Pipeline plugin is used in Jenkins for making the Jenkins Pipeline, which gives us the view of stages or tasks to perform one after the other in the pipeline form. It models a series of related tasks. Pipelines help the teams to review, edit and iterate upon the tasks. Pipelines are durable and it can optionally stop and wait for human approval as well to start the next task. A pipeline is extensible and can perform work in parallel. It supports complex CD requirements.
Agent: It is directive to tell Jenkins to execute the pipeline in a particular manner and order.
Post-section: If we have to add some notification and to perform other tasks at the end of a pipeline, post-section will definitely run at the end of every pipeline’s execution.
Jenkinsfile: The text file where all the definitions of pipelines are defined is called Jenkinsfile. It is being checked in the source control repository.
Let us take the example of AWS cloud service. Cloud computing services use the CI/CD model so that they can push their work to the customers and constantly receive feedback. Jenkins is used to automating the CI/CD pipelines. For example, a lot of Jenkins plugins are available for many of the AWS services like Amazon EC2 and ECS.
Kubernetes is a container orchestration tool. With Kubernetes, one can create multiple container instances to achieve more fault tolerance. You can use the Kubernetes deploy plugin to use it with Jenkins for continuous deploy.
Yes, this can be done easily. Automated tests can be run through tools like Selenium or maven. Developers can schedule the test runs. Jenkins displays the test results and sends a report to the developers.
You just need to restart the pipeline from the point where it failed by doing ‘restart from stage’.
All the settings, logs and configurations are stored in the JENKINS_HOME directory.
This is a helpful plugin that backs up all the critical settings and configurations to be used in the future. This is useful in cases when there is a failure so that we don’t lose the settings.
Triggers are used to define when and how pipelines should be executed.
When Jenkins is integrated with an SCM tool, for example, Git, the repository can be polled every time there is a commit.
The Git plugin should be first installed and set up.
After this, you can build a trigger that specifies when a new build should be started. For example, you can create a job that polls the repository and triggers a build when a change is committed.
A build can take several input parameters to execute. For example, if you have multiple test suites, but you want to run only one. You can set a parameter so that you are able to decide which one should be run. To have parameters in a job, you need to specify the same while defining the parameter. The parameter can be anything like a string, a file or a custom.
There are 2 ways to start the node agent –
Browser – if Jenkins node agent is launched from a browser, a JNLP (Java Web Start) file is downloaded. This file launches a new process on the client machine to run jobs.
Command-line – to start the node agent using the command line, the client needs the executable agent.jar file. When this file is run, it simply launches a process on the client to communicate with the Jenkins master to run build jobs.
Below are the steps used for working with a third-party tool in Jenkins.
For different third-party tools, the procedure may vary slightly, because of the difference in configuration settings.
There are 3 types –
The cron syntax.
Cron syntax is represented using five asterisks each separated by a space. The syntax is as follows – [minutes] [hours] [day of the month] [month] [day of the week]. Example, if you want to set up a cron for every Monday at 11.59 pm, it would be 59 11 * * 1
DevOps is a software development practice that blends software development (Dev) with the IT operations (Ops) making the whole development lifecycle simpler and shorter by constantly delivering builds, fixes, updates, and features. Jenkins plays a crucial role because it helps in this integration by automating the build, test and deployment process.
There are many other CI tools, and the most prominent ones are –
There are many more. We cannot say if Jenkins is better than each because each has its own unique features. For example, TeamCity offers great .NET support but is complex and costly, Travis CI is free just like Jenkins and has good documentation too. Bamboo too offers efficient and faster builds but is not completely free and so on.
There are numerous environment variables that are available by default in any Jenkins build job. A few commonly used ones include:
Note that, as new Jenkins plug-ins are configured, more environment variables become available. For example, when the Jenkins Git plug-in is configured, new Jenkins Git environment variables, such as $GIT_COMMIT and $GIT_URL, become available to be used in scripts.
In software development, multiple developers or teams work on different segments of the same web application. So in this case, you have to perform integration testing 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 codes get tested. This process is known as continuous integration.
Here are the steps –
All the developers commit their source code changes to the shared Git repository.
Jenkins server checks the shared Git repository at specified intervals and detected changes are then taken into the build.
The build results and test results are shared to the respective developers
The built application is displayed on a test server like Selenium and automated tests are run.
The clean and tested build is deployed to the production server.
The Jenkins “Job DSL / Plugin” is made up of two parts – first, The Domain Specific Language (DSL) itself that allows users to describe jobs using a Groovy-based language, and second, a Jenkins plugin which manages the scripts and the updating of the Jenkins jobs which are created and maintained as a result.
The Multibranch Pipeline project type enables you to implement different Jenkinsfiles for different branches of the same project. In a Multibranch Pipeline project, Jenkins automatically discovers, manages and executes Pipelines for branches that contain a Jenkinsfile in source control.
These are the types of jobs/projects in Jenkins –
It is a project that was started with the purpose to rethink the user experience of Jenkins, modeling and presenting the process of software delivery by surfacing information that’s important to development teams. This is done with as few clicks as possible, while still staying true to the extensibility that is core to Jenkins. While this project is in the alpha stage of development, the intent is that Jenkins users can install Blue Ocean side-by-side with the Jenkins Classic UI via a plugin
Continuous Testing is the process where you execute automated tests as part of the software delivery pipeline. This is done so that you get the feedback on the business risks associated with software as early as possible. It consists of evolving and extending test automation to address the increased complexity and pace of modern application development and delivery.
Continuous Testing means that testing takes place on a continuous basis without any disruption of any kind. In a Continuous DevOps process, a software change is continuously moving from Development to Testing to Deployment. The code undergoes continuous development, delivery, testing and deployment.
I will approach this task by copying the jobs directory from the old server to the new one. There are multiple ways to do that, I have mentioned it below:
Move a job from one installation of Jenkins to another by simply copying the corresponding job directory.
Make a copy of an existing job by making a clone of a job directory by a different name.
Rename an existing job by renaming a directory. Note that if you change a job name you will need to change any other job that tries to call the renamed job.
These are the steps to integrate Git with Jenkins –
1.Click on the Manage Jenkins button on your Jenkins dashboard:
2. Click on Manage Plugins.
3. In the Plugins Page
4. Once you install the plugins , go to Manage Jenkins on your Jenkins dashboard. You will see your plugins listed among the rest.
The JENKINS_HOME folder contains a file named config.xml. When you enable the security, this file contains an XML element named useSecurity that changes to true. If you change this setting to false, security will be disabled the next time Jenkins is restarted.
However, we must understand that disabling security should always be both a last resort and a temporary measure. Once you resolve the authentication issues, make sure that you re-enable Jenkins security and reboot the CI server.
The flowchart below shows the Continuous Delivery Workflow. Hope it will be much easier to understand with visuals.
Continuous Delivery: (Manual Deployment to Production. Does not involve every change to be deployed.)
Continuous Delivery is a software development practice where you build software in such a way that the software can be released to the production at any time. You achieve Continuous Delivery by continuously integrating the products built by the development team, running automated tests on those built products to detect problems and then push those files into production-like environments to ensure that the software works in production.
Continuous Deployment: (Automated Deployment to Production. Involves deploying every change automatically)
Continuous deployment means that every change that you make, goes through the pipeline, and if it passes all the tests, it automatically gets deployed into production. So, with this approach, the quality of the software release completely depends on the quality of the test suite as you have automated everything.
Pipeline as Code describes a set of features that allow Jenkins users to define pipelined job processes with code, stored and versioned in a source repository. These features allow Jenkins to discover, manage, and run jobs for multiple source repositories and branches — eliminating the need for manual job creation and management.
To use Pipeline as Code, projects must contain a file named
Jenkinsfile in the repository root, which contains a “Pipeline script.”
Additionally, one of the enabling jobs needs to be configured in Jenkins:
Multibranch Pipeline: build multiple branches of a single repository automatically
Organization Folders: scan a GitHub Organization or Bitbucket Team to discover an organization’s repositories, automatically creating managed Multibranch Pipeline jobs for them
Once you have prepared yourself with these Jenkins interview questions, then no one can stop you from getting your dream job.
I have included the frequently asked Docker interview questions. If you have more questions in your mind just type it in the comment box below and we will reply you ASAP. Before going for the interview I will suggest you to check out this Jenkins blog series.
If you found this blog on Docker Interview Questions relevant, check out the DevOps training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios and GIT for automating multiple steps in SDLC.