Introduction to Jenkins Interview Questions And Answers
Jenkins is a software tool that is used for continuous integration of development process. It is an open source tool, readily available and written in Java. It is used as automation tool to automate all the tasks in software development process like coding, testing, and deployment. Jenkins can be used with almost all the plugins to make continuous integration smooth and working. Jenkins itself is not doing anything like to check code or testing, it just gives commands to plugins to run after completion of a particular task. It means Jenkins form a process of tasks to be done and that process of tasks referred to as pipeline or Jenkins pipeline. When one task gets successfully completed in the pipeline then other tasks will get started and so on.
Jenkins is just an orchestrator, which makes the life of the developer easier to keep the tack of successful build and integrate changes continuously and rectify the defects on time. Jenkins is also referred as CI tool (Continuous integrated tool). Continuous integration is a process where every team member is working on different modules and at the end of the day everyone is committing their changes in SCM (Source code management, where the code is centralized for a team) and to check the integrated code working fine or tested on daily basis.
So you have finally found your dream job in Jenkins but are wondering how to crack the Jenkins Interview and what could be the probable Jenkins Interview Questions. Every interview is different and the scope of a job is different too. Keeping this in mind we have designed the most common Jenkins Interview Questions and Answers to help you get success in your interview.
Below are some of the Jenkins Interview Questions that are frequently asked in the interview are as follows:
1. Define the process of Jenkins?
Please start with the brief introduction about Jenkins as explained above in introduction section. The process of Jenkins is as follows:
- In Source code management repository, developers need to commit their code on daily basis or as per the team’s instructions because Jenkins check the repository changes at regular intervals. SCM can be GIT, SVN, and TFS. GIT and SVN are widely used nowadays.
- After committing the changes, Jenkins will detect the changes from a repository, will pull the changes and process of new build will be started.
- It will iterate through the different stages that are mentioned in the Jenkins pipeline. If one stage will get successfully completed then it will go to another task or stage.
- If particular stage fails, Jenkins build also stop there and it will not proceed further. Jenkins has a feature to send the email notification to a concerned team or to particular email id, which has been configured for Jenkins.
- If all the stages will successfully be completed then it deploys the code in particular mentioned server and testing will get started.
- If testing stage gets passed successfully, Jenkins will share the results with the team. The whole process keeps on iterating whenever code will be committed in SCM.
2.Mention pre-requisites for using Jenkins?
- Access to source code management repository like GIT or SVN repository.
- Build script that should be working like mavens builds script.
3. Explain the terms Agent, post-section, Jenkins file?
Agent: – It is directive to tell Jenkins to execute the pipeline in 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.
Jenkins file: – It is a text file having the information about Jenkins pipeline and is checked into source control.
4. Explain the advantages of using Jenkins?
Advantages of using Jenkins are:
- Do not need to check the code and start to build manually.
- Whenever there are changes in source code, an automatic build will get started.
- If there are any build failures, automatic email sends to concerned team.
- Bugs or defects can be easily tracked and resolved at early stages.
- Helps in achieving the continuous integration agile development and test-driven development.
- It makes the process faster and smoother.
5. What is the use of pipelines in Jenkins?
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 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.
6. Mention the steps to set up Jenkins Job?
The steps are:
- Go to Jenkins page, select ‘new job’
- Enter the name of the job and choose ‘build free-style project’.
- Click ok and start configuring your job.
- Put the details of SVN or GIT repository, where the source code has been placed.
- Provide all other information regarding plugins that required using in a project like for unit testing, code coverage, code quality.
- Mention the build tool script like Maven script.
- Collect the information regarding results
- Configure the steps to send the notifications via emails, etc.
7. How do you start the Jenkins manually?
The steps are as follow:
- Open the command line prompt and go to Jenkins installation directory.
- ‘Jenkins.exe start’ command helps in starting the Jenkins.
- ‘Jenkins.exe restart’ to restart Jenkins and ‘Jenkins.exe stop’ to stop Jenkins.
8.Mention steps to copy/move Jenkins from one server to other?
The steps are as follows:
- Copy the whole Jenkins directory from the first server and paste it to other servers.
- Make a copy of existing job by cloning a job directory with a different name.
- Rename an existing job by renaming the directory.
9. How to create a backup for Jenkins?
Take periodically back up of JENKINS_HOME directory by just copy this directory to other places. Rename, clone and replication of job can also be done.
10. How can we schedule build in Jenkins?
Whenever a change is committed in a repository, scheduled at a specified time, build manually and other builds get completed.
11. Which plugins are useful in Jenkins?
Some plugins are listed below:
- Maven (build tool)
- GIT (SCM)
- Selenium (continuous testing)
- Amazon EC2
- Puppet (Configuration management)
- Nagios (Continuous monitoring)
- Copy artifact
- HTML publisher
12. How do you secure Jenkins?
- Global security should be enabled.
- Jenkins should be integrated with appropriate plugins.
- Automate the process of setting rights and privileges.
- Limit the physical access to folders.
- Periodically run security audits.
This has been a guide to List Of Jenkins Interview Questions and Answers. Here we have covered the few commonly asked interview questions with their detailed answers so that it helps candidates to crack interviews with ease. You may also look at the following articles to learn more –
- TOP 12 Spark Interview Questions You Should Know
- 10 Important Ab initio Interview Questions And Answers
- Top 10 Useful Windows Server Interview Questions And Answers
- Java Interview Questions For Fresher | Most Important
- Jenkins vs Bamboo: Differences
- Jenkins vs Travis CI: What are the Functions
- Jenkins vs TeamCity: Want to know the Functions