Jenkins Interview Questions | 112 Frequently asked Jenkins Questions

112 Frequently Asked Jenkins Interview Questions and Answers

1. Why do we use Jenkins?
Answer: Jenkins is a continuous integration software tool which is open -sourced and written in the Java programming language to test and report on isolated changes in a larger code base in real time. The Jenkins software can enable developers for finding and solving defects in a code base rapidly and for automate testing of builds.

2. What is Maven and what is Jenkins?
Answer: Maven is a build tool which is a successor of ant. It will help in build and version control. Jenkins is continuous integration system which can be used to automate the deployment process.

3. What is continuous integration in Jenkins?
Answer: In Continuous integration process all development work is integrated at earliest. The resulting artifacts will be automatically created and tested. This process will allow to identify errors at earliest. Jenkins is a popular open source tool which will perform continuous integration and build automation.

4. Why do we use Jenkins with selenium?
Answer: Running Selenium tests in Jenkins will allow to run tests every time software changes and deploy the software to a new environment when the tests will pass. Jenkins will schedule tests to run at specific time.

5. What are CI Tools?
Answer: The list of the top eight Continuous Integration tools:
1. Jenkins
2. TeamCity
3. Travis CI
4. Go CD
5. Bamboo
6. GitLab CI
7. CircleCI
8. Codeship

6. What is a CI CD pipeline?
Answer: A continuous integration and deployment pipeline (CD/CI) is an important aspect of a software project. It will save a ton of manual, error-prone deployment work. It will result in higher quality software for continuous integration, automated tests, and code metrics.

7. What is build pipeline in Jenkins?
Answer: In Jenkins, Job chaining is the process of automatically starting other job(s) after the execution of a job. This approach will build multi-step build pipelines or trigger the rebuild of a project, if one of its dependencies will be updated.

8. What is a Jenkins pipeline?
Answer: The Jenkins Pipeline plugin is based on a Domain Specific Language (DSL) in Groovy, the Pipeline plugin will make pipelines scriptable. This is an incredibly powerful way for developing complex, multi-step DevOps pipelines.

9. What is a DSL Jenkins?
Answer: The Jenkins “Job DSL / Plugin” has two parts: The Domain Specific Language (DSL) itself that will allow users for describing jobs using a Groovy-based language, and a Jenkins plugin that will manage the scripts and the update of the Jenkins jobs which will be created and will be maintained as a result.

10. What is continuous integration and deployment?
Answer: Continuous Integration (CI) is a development practice which will require developers to integrate code into a shared repository several times a day. Each check-in will be verified by an automated build and allows teams to detect problems earliest.

11. What is the tool used for provisioning and configuration?
Answer: Ansible is an agent-less configuration management and orchestration tool. In Ansible, the configuration modules will be called as Playbooks. Like other tools, Ansible will be used to cloud provision.

12. What is the difference between Maven, Ant and Jenkins?
Answer: Maven and ANT both is build tool. Maven will provide dependency management, standard project layout and project management. Jenkins is a continuous integration tool that is much more than build tool.
It will consist of a pom.xml file which is specified in Jenkins to run the code. Whereas, Jenkins can be used as a continuous integration tool and automate the deployment process. The reports of the builds will be used to set a mark for continuous delivery as well.
Following are the differences between Maven, Ant, and Jenkins:

MavenAntJenkins
It is a Build Automation Tool.Java Library/Command Line Tool.Continuous Integration Tool.
Defines how the software is built and describes the software dependencies.Drives build process.Automates the software development process with Continuous Integration and facilitates Continuous Deliver.
Supports projects written in C#, Ruby.Supports projects written in C and C++.Supports version control tools like Git, AccuRev.
Executes Unit Tests will be the part of the normal build cycle.Supports single file execution introduced with Java II.Can execute Apache Ant and Apache Maven.

13. Which SCM tools Jenkins supports?
Answer: Jenkins can support version control tools that include AccuRev, CVS, Subversion, Git, Mercurial, Perforce, ClearCase and RTC, and will execute Apache Ant, Apache Maven and sbt based projects and an arbitrary shell scripts and Windows batch commands.

14. How schedule a build in Jenkins?
Answer: In Jenkins, we will define various build triggers under the job configuration.
1. Find the ‘Build Triggers’ section,
2. check the ‘ Build Periodically’ checkbox.
With the periodically build we will schedule the build definition by the date or day of the week and the time for executing the build.

15. Why do we use Pipelines in Jenkins?
Answer: Pipeline will add a powerful set of automation tools onto Jenkins, which supports use cases. Use cases will span from simple continuous integration to comprehensive continuous delivery pipelines. By modeling a series of related tasks, users will take advantage of the many features of Pipeline:
Code: Pipelines will be implemented in code. It will typically check into source control, providing teams the ability to edit, review, and iterate upon their delivery pipeline.
Durable: Pipelines will survive both planned and unplanned restarts of the Jenkins master.
Pausable: Pipelines will optionally stop and wait for human input or approval before continuing the Pipeline run.
Versatile: Pipelines will support complex real-world continuous delivery requirements, which will include the ability for fork/join, loop, and perform work in parallel.
Extensible: The Pipeline plugin will support custom extensions to its DSL and multiple options to integrate with other plugins.

16. What is a Jenkinsfile?
Answer: Jenkinsfile is a text file which has the definition of a Jenkins Pipeline and will be checked into source control.
Creating a Jenkinsfile, which will be checked into source control, will provide a number of immediate benefits:

1. Code review/iteration on the Pipeline
2. Audit trail for the Pipeline
Single source of truth for the Pipeline, that will be viewed and will be edited by multiple members of the project.

17 What is blue ocean in Jenkins?
Answer: Blue Ocean is a project which will model and present the process of software delivery by surfacing information which is important for development teams with as few clicks as possible, while still will be staying true to the extensibility which is core to Jenkins.

18. What are the important plugins in Jenkins?
Answer: List of some important Plugins in Jenkins:
1. Maven 2 project
2. Git
3. Amazon EC2
4. HTML publisher
5. Copy artifact
6. Join
7. Green Balls

19. What are Jobs in Jenkins?
Answer:
will be used for performing the typical build server work, like doing continuous/official/nightly builds, run tests, or perform some repetitive batch tasks. These jobs are called “free-style software project” in Jenkins.

20. How do you create a Job in Jenkins?
Answer: Steps to create a Job in Jenkins:
1. Go to Jenkins top page, select “New Job”,
2. choose “Build a free-style software project”.
This job type consists of the following elements:
Optional SCM, like CVS or Subversion where source code will be resided.

Optional triggers for controlling when Jenkins will perform builds.

some sort of build script which will perform the build (ant, maven, shell script, batch file, etc.) where the real work will happen optional steps for collecting information out of the build, like archiving the artifacts and/or recording javadoc and test results.
Optional steps to notify other people/systems with the build result, like sending e-mails, IMs, updating issue tracker, etc.

21. How do you configuring automatic builds in Jenkins?
Answer: Builds in Jenkins will be triggered periodically on a schedule. It is specified in configuration, or when source will change in the project have been detected, or they will be automatically triggered by requesting the URL: http://YOURHOST/jenkins/job/PROJECTNAME/build

22. How to create a backup and copy files in Jenkins?
Answer: To create a backup, all we required to do is to periodically back up JENKINS_HOME directory. This will contain all of build jobs configurations, we will slave node configurations, and build history. For creating a back-up of Jenkins setup, just copy this directory.

23. What are the various ways in which build can be scheduled in Jenkins?
Answer: Builds will be triggered by source code management commits, will be triggered after completion of other builds and it can be scheduled to run at specified time (crons) Manual Build Requests

24. What is the relation between hudson and Jenkins?
Answer: Hudson was the earlier version of current Jenkins and the project name was changed from Hudson to Jenkins.

25. What you do to make sure that your project build doesn’t break in Jenkins?
Answer: To make sure that project build doesn’t break in Jenkins, perform successful clean install on my local machine with all unit tests. Check all code changes and Synchronize it with repository for making sure that all required config and POM changes and any difference will be checked into the repository.

26. What you do when you see a broken build for your project in Jenkins?
Answer: Open the console output for the build and will try to see if any file changes were missed when we see a broken build build for project in Jenkins.
If not able to find the issue in the above way, it should be cleaned and update local workspace to replicate the problem on local and try to solve it.

27. Explain what is continuous integration?
Answer: When multiple developers will work on different segments of same web application, it is required to perform integration test by integrating all modules in software development. An automated process for each piece of code is performed daily therefore that all code will be tested to perform this task.

28. What is the requirement for using Jenkins?
Answer: Following are the requirement for using Jenkins:
1. A source code repository that is accessible, for instance, a Git repository
2. A working build script, example for a Maven script, checked into the repository.

29. What are the advantages of Jenkins?
Answer: Following are some advantages of using Jenkins or by any matter any integration tools:
1. it saves developer time: Most of the integration task is being handled by Jenkins via automatic integration; the developer time will be focused on development activities mostly.
2. Improved software quality: Since the software is can be tested immediately after any code check-in, it will keep the quality check frequently, thus improves overall software quality.
3. Faster Delivery: Jenkins automatically perform continuous integration, which will lead to very early detection of bugs / defects and hence it will lead to faster delivery of software.
4. Decreased development time: Since most of the integration work will be automated by Jenkins, it will lead to the faster development of application.
5. Easily portable: Since Jenkins will be developed using Java, it will easily portable to other platforms.
6. Early tracking of defects: Jenkins will help tacking of defects at very early stage in development environment only rather than production environment.
Email Notification to developers:Jenkins is easily integrated with LDAP server, so developer can be notified about build success / failure via mail.

30. What is the difference between Jenkins and Bamboo??
Answer:

ParametersJenkinsBamboo
Open SourceIt is open-sourceIt is not open source
Pricing Logiccompletely freecharges for the number of build agents required
Operating SystemWindows, Ubuntu, Red Hat, Mac OSWindows, Linux, Solaris
BrowsersChrome, Firefox, Internet ExplorerFirefox, Chrome, Safari, Edge
Plugin Supportsupports a lot of pluginsIt does not support many plugins as Jenkins
SupportIt has a lot of support from communitiesIt has less support

31. Define the process of Jenkins.
Answer: 1. A developer will commit the code to the source code repository. The Jenkins server will check the repository at regular intervals for changes.
2. The Jenkins server will detect the changes which have occurred in the source code repository. Jenkins can pull those changes and will start preparing a new build.
3. If the build will fail, then the concerned team can be notified.
4. If the build will be successful, then Jenkins can deploy the build in the test server.
5. After testing, Jenkins will generate feedback and then it will notify the developers about the build and test results.
6. It can continue to check the source code repository for changes made in the source code and the whole process will keep on repeating.

32. Mention what are the commands you can use to start Jenkins manually?
Answer: To start Jenkins manually, we will use either of the following
1. (Jenkins_url)/restart: Forces a restart without waiting for builds for completeion
2. (Jenkin_url)/safeRestart: Allows all running builds for completion.

33. List useful plugins in Jenkin?
Answer: Some of the important plugins in Jenkin will include
1. Maven 2 project
2. Amazon EC2
3. HTML publisher
4. Copy artifact
5. Join
6. Green Balls

34. Explain how you can deploy a custom build of a core plugin?
Answer: To deploy a custom field of a core plugin,We have to do following things:
1. Stop Jenkins
2. Copy the custom HPI to $Jenkins_Home/plugins
3. Delete the previously expanded plugin directory
4. Make an empty file called .hpi.pinned
5. Start Jenkins

35. Explain how you can clone a Git repository via Jenkins?
Answer: To clone a Git repository via Jenkins, we have to enter the e-mail and user name for Jenkins system. To do that we have to switch into job directory and execute the “git config” command.

36. Explain how you can set up Jenkins job?
Answer: To create a project this is handled via jobs in Jenkins.
1. Select new item from the menu.
2. Once this done enter a name for the job and select free-style job.
3. Click OK to create new job in Jenkins.
4. The next page enables to configure job.

37. Mention what are the two components Jenkins is mainly integrated with?
Answer: Jenkin is integrated with following components
1. Version Control system like GIT, SVN
2. Build tools like Apache Maven

38.Mention what are the commands you can use to start Jenkins manually?
Answer: Following are the commands we can use to start Jenkins manually:
# service jenkins start
# service jenkins stop
# service jenkins restart
(or)
# systemctl start jenkins
# systemctl stop jenkins
# systemctl restart jenkins

39. How do you restart jenkins without disturbing the running jobs?
Answer: Using safeRestart. In jenkins URL add ‘/safeRestart’ for safely restart the jenkins.
‘safeRestart’ waits to finish all the running jobs and then it will restarts jenkins.
‘/restart’ will terminate all the running jobs and it will restart jenkins.

40. What are the steps in while creating Jenkins job?
Answer: Following are the steps in while creating Jenkins Job:
General, Source code Management, Build trigger, Build, Post-Build.

41. How can you decide the no. executors?
Answer: No. Executors is number of parallel jobs, based on requirement If we required, jenkins should run at max 5 parallel jobs we will provided the number at No. executors.

  • Manage Jenkins → Configure system → Number of parallel jobs: 5

42. Where did your plugins come from Jenkins?
Answer: Plugins can be downloaded from plugins.jenkins.io site

43. How do you install Jenkins?
Answer: To install Jenkins, we just required to follow these following steps:
1. Install Java Version 8 – Jenkins is a Java based application.
2. Install Apache Tomcat Version 9 – Tomcat is essential to deploy Jenkins war file.
3. Download Jenkins war File – This war is must to install Jenkins.
4. Deploy Jenkins war File – You deploy Jenkins war file using Tomcat to run Jenkins.
5. Install Suggested Plugins – Install a list of plugins suggested by Jenkins.

Once the installation is complete, we will be able to see the Jenkins dashboard.

44. What is Maven? List the benefit of integrating Maven with Jenkins.
Answer: Maven is a build management tool which will use a simple pom.xml for configuring all the dependencies required to build, test and run the code. Maven will manage the full lifecycle of a test project. Once integrated with Jenkins, the maven Webdriver can build the project and will execute all tests efficiently.

45. What you mean by auto layout in Objective C?
Answer: Auto Layout is a new way for defining dynamic GUIs. Before we had autoresizing masks, which can describe how a subview can resize or move when superview is resized. With Auto Layout we will do the same and complicated GUIs also quite easily.

46. Can we access jenkins in command mode?
Answer: We have ‘Jenkins CLI’ to access jenkins in command mode under ‘Manage Jenkins’.

47. How do you create Multibranch Pipeline in Jenkins?
Answer: The Multibranch Pipeline project type will enable us to implement different Jenkinsfiles for different branches of the same project. In a Multibranch Pipeline project, Jenkins will automatically discover, manage and execute Pipelines for branches which will contain a Jenkinsfile in source control.

48. How many environments are there in your current project?
Answer: Dev, Test, Pre-production and Production environment are there in current project

49. Is it possible to exchange jobs between two different jenkins?
Answer: Yes, it is possible by using ‘Job Import’ plugin. We will exchange the job between two jenkins. We required providing the source instance (Jenkins) URL. We will import a particular job and all the jobs and also views.

50. Explain role-based strategy plugin?
Answer: We will create ‘Global roles’, ‘Project roles’ and ‘Slave roles’ and assigning roles to users by using role-based strategy,
1. Global roles: admin, Job creator, anonymous, etc. will allow to set Overall, slave, job, Rn, View and SCM permissions on a global basis.
2. Project roles: Allow to set only Job and Run permissions on a project basis.
3. Slave roles: Allow to set node-related permissions.

51. Suppose we have two projects in my jenkins both are of different Java versions. How can we build the projects when both projects are of different versions and only one version of java is configured in Global tool configuration?
Answer: We can configure multiple java versions in Global Tool configuration to support different versions of projects.

52. How your jenkins come to know which version to choose when two versions of Java are configured?
Answer: When we will start build jenkins it is asked to choose on which version of Java the build/job has to run.

53. What are Declarative Pipelines in Jenkins?
Answer: Declarative Pipelines are the newest additions to Jenkins which will simplify the groovy syntax of Jenkins pipelines (top-level pipeline) with some exceptions, like:
No semicolon are used as a statement separator. The top-level pipeline can be enclosed within block viz;

The common syntax is:
pipeline {
/* Declarative Pipeline */
}
Blocks must contain Sections, Directives, steps or assignments.
pipeline {
agent any
stages {
stage(‘Build’) {
steps {
// Statements…
}
}
stage (‘Test’) {
steps {
// Statements…
}
}
}
}

The above code has following major elements
1. Pipeline: The block of script contents.
2. Agent: It will define where the pipeline will start running from.
3. Stage: The pipelines will contain several steps enclosed in the block called Stage.

54. How do you change the Jenkins Home Directory?
Answer: First copy entire Jenkins home directory to which directory we required to make a new home directory, next Update that directory in /etc/sysconfig/jenkins file.

55. Which plugin is required to deploy a .war file into application server?
Answer: ‘Deploy to Container Plugin’ is required to deploy a.war file into application server.

56. How can you send the BIOS a query message directly from the command line?
Answer: In pipeline we can break our jobs out into different stages and we have whatever stage we required to represent the process we use to deploy software and of course, if anything will be wrong, we can see which stage had the problem.

  • The important difference between any job and a Pipeline Job is that the Pipeline Scripted job will run on the Jenkins master, in the Freestyle job and everything will be executed in the agent, but for the Scripted Pipeline Job, the pipeline code will be translated in the master to atomic commands which are sent to the agents.

57. What is upstream and downstream projects in jenkins?
Answer: Nothing but dependency of jobs.

  • Upstream: if we will set job1 is upstream for job2. Then job1 will be built to build job2.
  • Downstream: if we will set job2 is downstream in job1. Then if we can build job1 then automatically job2 can also be build.

> In ‘Build triggers’ section we will set the upstream projects.
> In ‘Post-build’ section we will set downstream projects.

58. How to re-execute a parameterized build without entering the parameter value when the job fails?
Answer: ‘Rebuild plug-in’ will allow the user to rebuild a parametrized build without entering the parameters again.

59. How can you pass parameters from one job to another job?
Answer: When we will create new/existing job go to –> General tab –
–> enable ‘This project will be parameterized’ –> select ‘Run parameter’ from drop down –> in project tab select the project name (from which project it will take the parameters).

60. How master system will communicate to slave system?
Answer: using ‘slave.jar’ file in slave system master system will communicate to slave system. This file must be present in slave to communicate with.

61. How do you make a job to run only on slave node?
Answer: Go to job configuration tab –> under ‘General’ section enable ‘Restrict where this project will be run’ then we will provide the lable name of the node. 

62. How do you make all the jobs to be run only on slave node?
Answer: Go to –>’Manage jenkins’ –> ‘configure system’ –> at ‘Labels’ mention the node system label.

63.What is Quite period in Jenkins?
Answer: Time gap between the builds. In seconds.

64. What is SCM Checkout retry count?
Answer: It can check the code in SCM tool twice in between the builds, if the value is 2.

65.How do you delete old builds?
Answer: Delete old builds in following way
go to –> General tab –> enable ‘Discard old Builds’
checkbox. Here we will set ‘Days to keep builds’ and ‘Max # of builds to keep’

66. Which plugins you are using?
Answer: Role-based strategy – create global roles, project roles and slave roles.
Backup –
Thin Backup –
Green Ball – Green ball plugin will indicate when job is successfully completed it shows green color instead of blue. 
Build Pipeline –
Delivery Pipeline –
Next Build Number –
Rebuild –
SonarQube –
Parameter trigger –
Disk Usage –

67. Plugins website down what will you do and how can you download plugins?
Answer: Usually companies maintain repository for plugins download. If plugins is not maintained in the repository by the companies then we download from any other website and upload in to company’s repository and add the plugin.

68. What is difference between Build periodically and Poll SCM?
Answer: Build periodically – It can trigger builds as per the schedule, even if we haven’t changed anything.
Answer: Poll SCM – It can check for changes before triggering any build, if there will be any changes to the previous version than only build can be triggered. Otherwise it will not the build.

69. Explain how do create a backup and copy files in Jenkins?
Answer: Jenkins will save all the settings, build artefacts and logs in its home directory so when we will required to create backup of jenkins setup, copy the jenkins home directory and rename the directory.Install the Backup plugin by plugin backup the jenkins.
If we will automate the backup using the thin_backup plugin. Using this plugin, we will schedule the backup.

70. How will you secure Jenkins?
Answer: Following way Jenkins can be secured:
1. Ensure global security is on.
2. Ensure that matrix based is enabled to fine tune access.
3. Automate the process of setting rights/privileges in Jenkins with custom version-controlled script.
4. Limit physical access to Jenkins data/folders.
5. Periodically run security audits on same.

71.Explain how you can deploy a custom build of a core plugin?
Answer: Following are the steps to deploy a custom build of a core plugin:
1. Stop Jenkins.
2. Copy the custom HPI to $Jenkins_Home/plugins.
3. Delete the previously expanded plugin directory.
4. Make an empty file called .hpi.pinned.
5. Start Jenkins.

72. How will you give the customized/custom build numbers in jenkins?
Answer: By using Next_Build_Number plugin, we will change the build number of a jenkins.

  • We will only change the build numbers for failed builds, not for success builds.

73. Why we use Nodes in jenkins?
Answer: 1. Single jenkins server will not handle the whole workload of large and heavier build projects.
2. Sometimes we may required several different environments to test the builds. This will not be done by a single server.

74. How do you send the notifications whether build fails or success?
Answer: Method to send the notifications whether build fails or success
1. Configure Email Notification in Configure system under Mange Jenkins.
2. Email notifications will be configured in job configuration under post-build section.

75. How do you manage Users? Explain method to create particular project-based authentication in jenkins.
Answer: MWe will manage users in two ways –
1. Role-based strategy
2. Project based’ authentication
create particular project-based authentication in jenkins in following ways
1. We will manage user’s permissions. Such as view, create, modify, delete a job and restricting user to access ‘Manage Jenkins’ and etc.
2. We will Create global roles, such as admin, job creator, anonymous, etc. suc Overall, Slave, Job, Run, View and SCM permissions on a global basis)
3. Create project roles and assign the roles to users.
4. It will restrict user to access particular project/job.

76. How to migrate a jenkins job to new jenkins server?
Answer: To migrate a Jenkins job to new Jenkins server use following process:
1. Copy a job from one jenkins server to another jenkins server corresponding job directory.
2. we should ‘reload config’ in ‘Manage Jenkins’

77. How you can move or copy Jenkins from one server to another?
Answer: Following way we can move or copy Jenkins from one server to another:
1. By copying the related job directory slide a job from one installation of Jenkins to another.
2. By a different name Renaming an existing job by renaming a directory, make a copy of an already existing job by making clone of a job directory.

78. How you can deploy a custom build of a core plugin?
Answer: To deploy a custom field of a core plugin, We do following things:
1. Stop Jenkins
2. Copy the custom HPI to $Jenkins_Home/plugins
3. Delete the previously expanded plugin directory
4. Make an empty file called .hpi.pinned
5. Start Jenkins

79. How you can setup Jenkins jobs?
Answer: Jenkins jobs can be setup by following ways:
1. Select new item from the menu.
2. After that enter a name for the job and select free-style job.
3. Then click OK to create new job in Jenkins.
4. The next page enables to configure job.

80. How can you clone a Git repository via Jenkins?
Answer: If we want to clone a Git repository via Jenkins, we have to enter the e-mail and user name for Jenkins system. Switch into job directory and execute the “git config” command for that.

81. Name two ways a Jenkins node agent can be configured to communicate back with the Jenkins master.
Answer: The tool will provide two mechanisms for starting a Jenkins node agent:
1. Launching a Jenkins node agent from a browser window.

2. Launching a Jenkins node agent from the command line.
When a Jenkins node agent will be launched from a browser, a JNLP file can be downloaded. When it will run, the JNLP file will launche a new process on the client machine which runs Jenkins jobs.

To launch from the command line, the agent.jar file is needed on the client. This executable JAR file will run from the command line, along with a reference to the slave agent’s JNLP file which is hosted on the server. Like the JNLP file is downloaded through a web browser, running this command will launche a process on the client which can communicate with the Jenkins master and will run Jenkins build jobs when it will have idle clock cycles.

82. How will you secure Jenkins?
Answer: In following way we can secure Jenkins:
1. Ensure global security is on.
2. Ensure Jenkins is integrated with my company’s user directory with appropriate plugin.
3. Ensure matrix/Project matrix is enabled to fine tune access.
4. Automating the process to set rights/privileges in Jenkins with custom version controlled script.
5. Limit physical access to Jenkins data/folders.
6. Periodically run security audits on same.

83. Minimum JRE required for a run of Jenkin 2.1?
Answer: Minimum JRE required for a run of Jenkin 2.1 is JRE8 or Else JDK8

84. Name a Jenkins environment variable you have used in a shell script or batch file.
Answer: There are many environment variables which are available by default in any Jenkins build job.
Following are commonly used ones include:

  1. $JOB_NAME
  2. $NODE_NAME
  3. $WORKSPACE
  4. $BUILD_URL
  5. $JOB_URL

Note that, as new Jenkins plug-ins will be configured, more environment variables will be available. For example, if the Jenkins Git plug-in will be configured, new Jenkins Git environment variables, such as $GIT_COMMIT and $GIT_URL, become available to be used in scripts.

85. Describe the standard process to configure and use third-party tools within Jenkins?
Answer: The process to use a third-party tool, like Artifactory, Node, SonarQube or Git typically will follow following steps.
1. The third-party software will be installed.
2. A Jenkins plug-in which will support the third-party tool must be installed through the Jenkins admin console.
3. The third-party tool will be configured in the Tools tab of the Manage Jenkins section of the admin console.
4. Finally, the plug-in will be used from within a Jenkins build job. The plug-in can then facilitate communication between the Jenkins build job and the third-party tool.
Every third-party tool is not configured in exactly the same way. For example, Jenkins will be configured to install Maven itself, rather than requiring a pre-existing installation.
Third-party tools, such as Checkstyle or JaCoCo, will be downloaded at build time by Maven. Therefore these above steps are not always adhered to strictly, but these are the typical steps required to install and configure a third-party Jenkins tool.

86. Name three security mechanisms Jenkins uses to authenticate users.
Answer: Jenkins will authenticate users in one of following ways:
1. Jenkins will use an internal database to store user data and credentials. (default method)
2. Jenkins will be configured for authenticating against a Lightweight Directory Access Protocol server.
3. Jenkins will be configured for employing the authentication mechanism used by the application server upon which it will be deployed.

87. How to make sure that your project builds doesn’t break in Jenkins?
Answer: We should follow Following steps to make sure that project builds does not break in Jenkins:
1. Perform successful clean install on local machine with all unit tests.
2. Check all code changes.
2. 3. Synchronize with repository to make sure that all required config and POM changes and any difference is checked into the repository.

88. Name three steps or stages a typical Jenkins pipeline might include.
Answer: A full-blown Jenkins pipeline can build a project from source code, put it through a variety of unit, integration, performance and user acceptance tests. Finally, if every test will succeed, deploy a packaged application to an application server, Nexus repository or Docker container.
Therefore, three fundamental stages would be:
1. Build
2. Test
3. Deploy

The best method to implement a Jenkins pipeline as code is to employ many modular steps.

89. How can you temporarily turn off Jenkins security if the administrative users have locked themselves out of the admin console?
Answer: The JENKINS_HOME folder will contain a file named config.xml. When security is enabled, this file will contain an XML element named useSecurity which will be set to true. By changing this setting to false, security can be disabled the next time Jenkins will restarted.
false
Disabling security will always be both a last resort and a temporary measure. Once any authentication problem are resolved, be sure to re-enable Jenkins security and reboot the CI server.

90. Polling a Git repository for new commits is considered a Jenkins anti-pattern. What is a sound alternative to SVN polling?
Answer: Polling a source code management tool such as Git or Subversion to check if a new commit will be issued is a waste of clock cycles and must be avoided.
A good approach is by reversing this process and has the source code tool trigger a Jenkins build when new commit will happen. With GitHub or GitLab, it will be relatively easy to configure a post-commit hook which will run every time a commit is successful. When it is provided with the URL of the Jenkins build, the post-commit hook will easily trigger a Jenkins build, eliminating the required to have Jenkins constantly poll the source code repository.

91. What are Jenkins Installation Requirements?
Answer: Following are Jenkins Installation requirements:
1. Jenkins will require Java7 or above and Servlet 3.1 to function.
2. Java8 can be recommended.
3. Jenkins will require a fair amount of memory to operate well.

Smaller installations will start around 256MB 1GB.

92. Explain how you can deploy a custom build of a core plugin?
Answer: Following are the steps to deploy a custom build of a core plugin:
1. Stop Jenkins.
2. Copy the custom HPI to $Jenkins_Home/plugins
3. Delete the previously expanded plugin directory.
4. Make an empty file called .hpi.pinned.
5. Start Jenkins.

93. Explain the terms Agent, post-section, Jenkins file?
Answer: 1. Agent– It is directive to inform Jenkins for executing the pipeline in particular manner and order.
2. Post-section– If it is required to add some notification and for performing other tasks at the end of a pipeline, post-section can definitely run at the end of every pipeline’s execution.
3. Jenkins file – It will be a text file having the information about Jenkins pipeline and will be checked into source control.

94. What is the programming language used to build Jenkins?
Answer: Java is to build Jenkins which is an open source automation server.

95. What is a Continuous delivery pipeline?
Answer: A continuous delivery pipeline which is an automated expression of process to get software from version control right through to users and customers.

96. Can you write a simple Jenkins Pipeline Code for Java?
Answer: Following is the simple Jenkins Pipeline Code for Java:
Jenkinsfile (Declarative Pipeline)
pipeline {
agent { docker ‘maven:3.3.3’ }
stages {
stage(‘build’) {
steps {
sh ‘mvn –version’
}
}
}
}

97. What is Declarative Pipeline in Jenkins?
Answer: Declarative Pipeline will be a relatively recent addition to Jenkins Pipeline [1] which will present a more simplified and opinionated syntax on top of the Pipeline sub-systems.
All valid Declarative Pipelines should be enclosed within a pipeline block, for example:

pipeline {
/* insert Declarative Pipeline here */
}

98.What is the agent directive in Jenkins?
Answer: The agent directive inform Jenkins where and how to execute the Pipeline, or subset thereof.
Underneath the hood, there are following things agent causes to happen:
All the steps which contained within the block are queued for execution by Jenkins. As soon as an executor will be available, the steps can begin to execute.
A workspace will be allocated which contains files checked out from source control and any additional working files for the Pipeline.

99. What are Parameters in Jenkins?
Answer: To support the wide variety of use-cases Pipeline, authors might have the agent section which will support a few different types of parameters. These parameters will be applied at the top-level of the pipeline block, or within each stage directive.

100. What is post?
Answer: The post section defines one or more additional steps which are run upon the completion of a Pipeline’s or stage’s run which depends on the location of the post section within the Pipeline.
Post will support one of the following post-condition blocks: always, changed, failure, success, unstable, and aborted.
These condition blocks will allow the execution of steps within the post section depending on the completion status of the Pipeline or stage.

101. What are stages?
Answer: Stage – Containing a sequence of one or more stage directives, the stages section is where the bulk of the “work” will be described by a Pipeline can be located. At a minimum it will be recommended which stages will contain at least one stage directive for each discrete part of the continuous delivery process, like Build, Test, and Deploy.

102. What is environment directive?
Answer: The environment directive will specify a sequence of key-value pairs which can be defined as environment variables for the all steps, or stage-specific steps, which depends on where the environment directive will be located within the Pipeline.

103. What are triggers?
Answer: The triggers directive will define the automated ways in which the Pipeline can be re-triggered. For Pipelines which will be integrated with a source like GitHub or BitBucket, triggers will not be necessary as webhooks-based integration can likely already be present. cron, pollSCM and upstream are currently available triggers.

104. What is input directive?
Answer: The input directive on a stage will allow to prompt for input, using the input step. The stage can pause after any options which has been applied, and before entering the stage`s agent or evaluating its when condition. If the input will be approved, the stage can then continue. Any parameters will be provided as part of the input submission can be available in the environment for the rest of the stage.

105. What is Parallel in Jenkins?
Answer: Stages in Declarative Pipeline will declare a number of nested stages within them, which will be executed in parallel. A stage should have only one of either steps or parallel. The nested stages cannot have further parallel stages themselves, otherwise behave the same as any other stage. Any stage which contains parallel cannot have agent or tools, since those are not relevant without steps

106. What is Scripted Pipeline in Jenkins?
Answer: Scripted Pipeline, such as Declarative Pipeline, is built on top of the underlying Pipeline sub-system. Unlike Declarative, Scripted Pipeline will be effectively a general purpose DSL [2] built with Groovy. Most functionality is provided by the Groovy language which is made available to users of Scripted Pipeline, that means it will be a very expressive and flexible tool with which one will author continuous delivery pipelines.

107. What is Flow Control in Jenkins?
Answer: Scripted Pipeline will serially executed from the top of a Jenkinsfile downwards, such as most traditional scripts in Groovy or other languages.

108. What are the software prerequisites that must be met before Jenkins is installed?
Answer: Jenkins with TeamCity:

ComparisonJenkinsTeamCity
Open SourceYesNo
Default securityNoYes
Individual validationNoYes
PopularityWidely usedNot so widely used

The software prerequisites for installing Jenkins are that first we required to install Java Development Kit. We can also required to install the Jakarta Enterprise Edition. Jenkins come along with an embedded Jetty Runtime that can be used if WebSphere or Tomcat is not available.

109. How to turn off Jenkins Security if the administrative users have locked out of the admin console?
Answer: There is a folder which will contain a file named config.xml. We required to change the settings to false for the security should be disabled when Jenkins will be started the next time.

110. Explain the Jenkins tool.
Answer:Jenkins will be thought of as an open-source automation tool which will be used for continuous integration. With Jenkins, we can be able to continuously test software projects therefore that developers can be able to integrate the changes to the project. We will also integrate this automation tool with a large number of testing and deployment technologies.

111. What is the difference between Continuous Integration, Continuous Delivery, and Continuous Deployment?Answer: Continuous Integration:
It will Involve keeping the latest copy of the source code at a commonly shared hub where all the developers will check to fetch out the latest change in order to avoid conflict.

Continuous Delivery:
Manual Deployment to Production.
It will not involve every change to be deployed.

Continuous Deployment:
Automated Deployment to Production.
It will involve every change to be deployed automatically.

112. What are Scripted Pipelines in Jenkins?
Answer: Scripted Pipeline will follow Groovy Syntax as following:
Node {
}
In the above syntax, the node is a part of the Jenkins distributed mode architecture, where there are two types of node Master that will handle all the tasks in the development environment and the Agent is being used for handling multiple tasks individually.

 

Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software. It simplifies the process of CI/CD (Continuous Integration/Continuous Delivery) for all popular programming languages and environments. Due to this unique feature, Jenkins goes well with any DevOps environment as well. As CI/CD has been increasingly the desired option for software deployment in most of the organizations, the demand for knowledge in Jenkins is high in current software industry, it is only going to grow.

If you are preparing for job interview that requires Jenkins knowledge, then we strongly suggest you to go through the above listed 112 frequently asked Jenkins Interview questions which will immensely help you to enrich your knowledge and also will help you to succeed in your next job interview.

Kiara is a career consultant focused on helping professionals get into job positions in the tech industry. She is also a skilled copywriter who has created well-crafted content for a wide range of online publications in the career and education industry.