Table of Contents
In this session, we will go through Top 250+ Jenkins Interview Questions and Answers for DevOps Professionals. Jenkins is used by most of the Organization for Continuous Integration and Continuous Deployment hence it is very important to have complete understanding about this tool. This is more required when you are going to face Jenkins Interview Questions. I have covered all the important Jenkins Interview Questions and Answers below.
Jenkins Interview Questions and Answers for DevOps Professionals
Also Read: 31+ Important Helm Charts Interview Questions and Answers for DevOps Professionals
1. What are different types of Pipeline in Jenkins ?
Ans. There are two different types of Pipeline in Jenkins:-
a)Declarative Pipeline
b)Scripted Pipeline
2. What is the difference between Declarative Pipeline and Scripted Pipeline ?
Ans. Declarative Pipeline is a very recent feature which allows easy use of code whereas Scripted Pipeline is a traditional way of writing code in Jenkins UI. The declarative pipeline is defined within a block labelled 'pipeline' whereas the scripted pipeline is defined within a 'node'. This is very important Jenkins Interview Question.
3. What is the difference between Github and Bitbucket ?
Ans. Github is basically focused around open community based projects whereas bitbucket is for private entity and organizations.
4. What is Pipeline in Jenkins ?
Ans. A pipeline is a set of Job in sequence to perform some specific Task. More on Jenkins Pipeline.
5. How to Integrate Jenkins with AWS Codepipeline ?
Ans. Using AWS Codepipeline Plugin
6. By Default, does a shell gets assigned for jenkins user after Jenkins Installation ?
Ans. No
7. By default, which User runs Jenkins ?
Ans. jenkins user
8. What is the default Jenkins home directory in Linux ?
Ans. /var/lib/jenkins
9. What is default Jenkins Port on which it listens to ?
Ans. Port 8080
10. From which file in Linux you can copy the administrator password for the first time login ?
Ans. /var/lib/jenkins/secrets/initialAdminPassword
11. Which tomcat file we need to edit to change the path of Jenkins to some other location ?
Ans. context.xml
12. How to Change the path of Jenkins from Tomcat context.xml file ?
Ans. <Environment name="JENKINS_HOME" value="/opt/jenkins_home" type="java.lang.String" />
13. What is the default location of tomcat context.xml file ?
Ans. /etc/tomcat/context.xml
14. Which configuration file in Jenkins can be used to change the location of Jenkins ?
Ans. /etc/sysconfig/jenkins
15. How to Change the Jenkins Home directory from /etc/sysconfig/jenkins file in Linux ?
Ans. JENKINS_HOME="/var/lib/jenkins"
16. How to Install Jenkins through docker ?
Ans. Jenkins can be installed using docker in a two step process:-
- docker pull jenkins/jenkins:lts
- docker run --name jenkins_master -p 8080:8080 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
17. From which version manual Jenkins setup wizard is added ?
Ans. It is added from Jenkins version 2.
18. What is the latest Jenkins version ?
Ans. As of 1st Dec 2020, 2.269 is the latest version.
19. How to disable Jenkins setup wizard from /etc/sysconfig/jenkins file ?
Ans. Add -Djenkins.install.runSetupWizard=false under double inverted comma in below Line.
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"
20. What is primary use of SonarQube ?
Ans. SonarQube is used to monitor the quality of code. It will look for Code Smells, Bugs and Vulnerabilities and suggest the fix for the same.
21. How to Install SonarQube in Linux using console mode ?
Ans. We need to run below Script from Installation directory to install it in console mode.
./install.sh console
22. What is the name of default embedded SonarQube database which is used for testing purposes only ?
Ans. H2 Database
23. What is the default SonarQube Port which it listens to ?
Ans. Port 9000
24. What is the default User name and password of SonarQube ?
Ans. User is "admin" and password is also "admin".
25. What is the command to run a SonarQube Scanner for Maven ?
Ans. mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login=<login_token>
26. How to Run SonarQube Using Maven ?
Ans. mvn sonar:sonar
27. What is POM in Maven ?
Ans. POM is known as Project Object Model. It is a fundamental unit of work in Maven. It is represented as pom.xml file which usually contains project configuration and other related information.
28. Which Plugin is required to Integrate SonarQube with Jenkins ?
Ans. SonarQube Scanner for Jenkins
29. Which Plugin needs to be installed to provide SSH credentials to build via ssh-agent in Jenkins ?
Ans. SSH Agent Plugin
30. What are the different options we need to set in Jenkins to create a Job ?
Ans. Below options needs to be set to create a Jenkins Job:-
a) General Job Settings
b) Source Code Management
c) Build Triggers
d) Build Environment
e) Build
f) Trigger Actions
31. How to trigger a Jenkins Job automatically after performing some code change in GITHub Repository ?
Ans. By setting option Jenkins->Build Triggers->GitHub Hook Trigger for GITScm Polling.