Jenkins Top Interview Questions 2021

How you would be facing your jenkins interview?

This article let you know the top Jenkins interview questions and its answers and you will easily crack your Jenkins interview.

So, let’s start it.

Beginners Interview Questions

1. What is Jenkins?

Ans- Jenkins is open source automation tool and its used mainly for continuous integration purpose within the software development process. It is written in Java and have so many plugins available to work on it and to integrate with other softwares and tools.

Moreover, you can explain the prior and after situations of the Jenkins and tell the interviewer how Jenkins resolve the real problems and help to build softwares fast and continiously.

2. Can you tell us about Jenkins pre-requisites?

Ans- You can tell the below mentioned pre-requisites for Jenkins,

  • Source-code repository. e.g. Git repo
  • Build script. e.g. Maven script

3. Do you know anything about Hudson?

Ans- Hudson was the earlier name and version of the current Jenkins. Due to some reason name changed from Hudson to Jenkins.

4. What are the useful plugins in Jenkins?

Ans- You can give the some popular and useful plugins name here,

  • Git
  • Maven2 project
  • Amazon EC2
  • HTML Publisher
  • Green balls
  • Copy artifact
  • Join

5. Tell us the steps to install Jenkins?

Ans- You can answers and tell the below simple steps to interviewer.

  • Install java (version8)
  • Install Apache Tomcat (version9)
  • Download Jenkins war file
  • Deploy Jenkins war file
  • Install suggested and required plugins

6. Why should we use Jenkins?

Ans- You can tell this top benefits of Jenkins;

  • Using Jenkins we can achieve continuous integration (CI)
  • Jenkins help to create auto build report notification
  • With Jenkins we can do automation of Maven projects
  • By using Jenkins we can easily tracking the bugs

7. Which are main components that used in Jenkins for integration?

Ans- The main components for Jenkins integrations are;

  • Version Control Tool e.g. Git and SVN
  • Build Tool e.g. Apache or Maven

8. Can you tell us the difference between Jenkins and Bamboo?

Ans- You can check and tell this basic differences to interviewer,

JENKINS BAMBOO
1. Jenkins is free and open-source1. Bamboo is not open-source
2. Jenkins is completely free 2. Bamboo charged for number of build agent
3. In term of easy of use Jenkins is little hard3. Bamboo tool is easy to use
4. Jenkins have large community support4. Bamboo not have community support
5. Cloud integration via plugins & Jenkins X5. Via Bitbucket pipelines

9. Can you tell us about Continuous Integration?

Ans- You can refer the diagram and explain the Jenkins CI process.

  • You can tell, Continuous Integration is a development practice where the codes can be integrated into a shared repository.
  • Using Jenkins Continuous Integration It’s triggers the build to find and identify bugs present in the code.
  • This CI practice uses automated verifications for the early detection of problems.

10. Can you explain Jenkins Pipeline?

Ans- Jenkins pipelines are used to continuous integration and continuous delivery of builds

  • Jenkins pipeline represents the continuous delivery and continuous integration of all the jobs in software development process and DevOps life-cycle.
  • Jenkins pipeline helps to solves several problems such as the maintenance of thousands of jobs
  • Jenkins pipeline is a set of plugins which support implementations and Integrations of continuous delivery pipelines into Jenkins.

11. What are the pipelines available in Jenkins?

Ans- Jenkins have three different pipelines;

  • CI/CD Pipeline
  • Scripted Pipeline
  • Declarative Pipeline

12. Do you know how to setup Jenkins jobs?

Ans- You can follow the below steps to setup Jenkins job;

  • Select New item from the menu
  • Enter a name for the job and select a free-style job
  • Now, you can click on ok to create a new job
  • Finally, the next page that appears will allow you to configure your job

13. Do you know how to create backup and copy file in Jenkins?

Ans- Jenkins home directory stores all the settings, builds scripts, and logs. If required to create a backup of this Jenkins set up then you have to copy this home directory. Job directory also be copied to clone a job or rename the directory.

14. Can you tell us, How to deploy custom builds of a core plugins?

Ans- Follow the below steps to deploy custom builds;

  • Stop Jenkins
  • Copy the custom HPI to $Jenkins_Home/plugins
  • Delete the previously expanded plugin directory
  • Make an empty file called .hpi.pinned
  • Eventually, you can start the Jenkins

15. What other Continuous Integration tools you know apart from Jenkins?

Ans- You can tell the few popular tools as mentioned below;

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

16. Can you tell us, How Jenkins works? It’s process or workflow?

Ans- You can explain the Jenkins workflow as mentioned below;

  • Once you created jobs in Jenkins. Jenkins checks changes in given repositories regularly, and developers must secure their code regularly.
  • If any changes are made in version control, Jenkins detects them and uses them to prepare a new build.
  • Jenkins will transverse through various stages in its usual pipeline. As one stage completes, the process will move further on to the next stage.
  • In case Jenkins any stage fails, build will stop there, and the software will email the team using it and in case if Jenkins stage completed successfully, then the code implements start on the destination server for testing.

17. What is Jenkins file?

Ans- Jenkins file is nothing but it is a text file that has a definition of a Jenkins pipeline and is checked into the source control repository. It enables code review and iteration on the pipeline. It also permits an audit trail for the pipeline.

18. Have you integrated Git with Jenkins? What is the process for it ?

Ans- Follow the below steps to Git-Jenkins integrations;

  • Check the Git plugin installed or not by going to plugins options.
  • If Git plugins not installed, you must install plugins such as GitHub plugin, GitHub Branch Source plugin, GitHub API plugin, Git client plugin, etc.
  • In case you install the plugins, you have to restart Jenkins
  • To check if Git is installed, you can go to Command Prompt and type Git, and you would see various options like usage, version, help, et
  • Once, plugins installation dine, create a new Jenkins job and open the Jenkins dashboard.
  • Now, you can enter the desired project name and select the job type and click ok.
  • Now enter the required project informations.

19. Can you tell us about DSL Jenkins?

Ans- DSL stands for Domain Specific Language.

  • Jenkins job DSL is a plugin which allows to create a jobs in the programmatic form with minimal efforts. You just have to define your jobs in Jenkins using a Groovy Based Language. They designed Jenkins job DSL plugin to create versions of the job and manage the records.

20. Which are the default environmental variables in Jenkins?

Ans- Default environmental variables are;

  • $JOB_NAME – The name that you give your job when it is first set up.
  • $NODE_NAME – This is the name of the node on which the current build is running.
  • $WORKSPACE – This refers to the path of the workspace
  • $BUILD_URL – This indicates the URL where the results of the builds can be found.
  • $JENKINS_URL – It is set to the URL of the Jenkins master that is responsible to running build.

Advanced Interview Questions

  1. How you configure Jenkins agent on node to communicate with Jenkins master?

Ans- You can say, we can do this with two ways and thats are;

  • Browser: If we launch the Jenkins node agent from a browser, a Java Web Start or JNLP file is downloaded. The downloaded file launches a new process on the client machine to run jobs.
  • Command-line: f you want to start the node agent using the command line, you need the executable agent.jar file. When this file runs, it launches a client’s process to communicate with the Jenkins master to run build jobs.

2. What is the purpose of Jenkins home directory?

Ans- Check the below informations about Jenkins home directory.

  • JENKINS_HOME directory contains all the settings, logs, and configurations. All this informations stored in XML files. 
  • Jenkins_home directory contains a subdirectory for every Jenkins build job being operated.
  • Every directory has two subdirectories:  builds and workspace., and some other files as well.
  • These sub directories are important, as the workspace directory is located at the place where Jenkins is building the project, and it contains the source code.
  • The builds directory stores the history of all the builds performed for this job.

3. Tell us about three security mechanisms that Jenkins use for user authentication?

Ans- Three security mechanisms are;

  • Jenkins uses internal database to store user data and credentials.
  • Jenkins can use a lightweight Directory Access Protocol (LDAP) server to authenticate users.
  • We can configure Jenkins to employ the application server’s authentication mechanism upon which we deploy it.

4. Can you tell us the various ways that build can be scheduled in Jenkins?

Ans- Jenkins builds can be triggered by many ways:

  • Jenkins build can be scheduled by committing in a version control system.
  • Scheduling using cron mechanisms and by requesting a specific build URL.
  • It can also be triggered after the other builds in the queue have completed.
  • In Jenkins Console under (Build Triggers – Build periodically – Schedule) schedules for Jenkins to build periodically or on a specific date/time can be set.
  • To set periodically scheduled Jenkins jobs one should schedule under Configure – Build Triggers – Build periodically – Schedule.

5. What is Jenkins CLI? Why should we use it?

Ans- Jenkins CLI is a command line interface.

  • Jenkins has a built-in command line interface that allows users and Jenkins administrators to access Jenkins from a shell environment.
  • Jenkins CLI helps for easy scripting of routine tasks, bulk updates, and troubleshooting.
  • The command line interface can be accessed over SSH or with the Jenkins CLI client.

6. What you can do if found any broken build?

Ans- In case of any broken build found then we can check the local workspace immediately and try to fix it quickly.

7. If Jenkins required move from one to another server, how can do that?

Ans- We have to follow below steps to do this:

  • Move 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

8. How to find Jenkins default installed port and change it to custom port?

Ans- We can find Jenkins default port by following below steps;

  • Go to the directory where you installed the Jenkins
  • Open the Jenkins.xml from the Jenkins directory.
  • Search “–httpPort=8080” and replace it with your custom port

9. Tell us how you can add Jenkins Webhook to Github?

Ans- To do this we have to access Jenkins Dashboard and perform the below steps;

  • Navigate to the “Settings” tab.
  • Select the “Webhooks” option on the left menu.
  • Click “Add Webhook”
  • Select “application/json” as the encoding type.
  • Leave “Secret” blank in Github section

10. Tell us what are the input directives in Jenkins?

Ans- This directive allows to prompt a user input in a build stage. It displays a message and waits for the user input. Once the input is approved, the stage will trigger further deployments.

11. What is Parallel in Jenkins?

Ans- Parallel is a directive, which allows to run nested stages in parallel and are defined and executed together. However, there are some restrictions like “Within a parallel directive you cannot nest another parallel directive

12. What is control flow in pipeline?

Ans- Execution of scripted pipelines are executed in a sequential order from top to the downwards is called as control flows in the pipeline.

13. How you get Jenkins admin default password?

Ans- We can get Jenkins default admin password at the time of Jenkins installation from below location.

  • .jenkins/secrets/initialAdminPassword remotely

Conclusion:

We have covered docker interview questions and answers for fresher and experienced candidate.

Related Articles:

Docker-containers top interview questions and answers for 2021

Install Jenkins on AWS Ec2 Instance

Reference:

Jenkins-documentation

DevOps Article

DevOps Article. Your Learnings Hub.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.