Jenkins Interview Questions

Jenkins-specific questions related to Docker that one can use during a DevOps Engineer interview

Jenkins Interview Questions

Table of contents

No heading

No headings in the article.

  1. What’s the difference between continuous integration, continuous delivery, and continuous deployment?

    • Developers practicing continuous integration merge their changes back to the main branch as often as possible. The developer's changes are validated by creating a build and running automated tests against the build. By doing so, you avoid integration challenges that can happen when waiting for release day to merge changes into the release branch.

    • Continuous delivery is an extension of continuous integration since it automatically deploys all code changes to a testing and/or production environment after the build stage. This means that on top of automated testing, you have an automated release process, and you can deploy your application at any time by clicking a button.

    • Continuous deployment goes one step further than continuous delivery. With this practice, every change that passes all stages of your production pipeline is released to your customers. There's no human intervention, and only a failed test will prevent a new change to be deployed to production.

  2. Benefits of CI/CD

    • Smaller Code Changes:

      One technical advantage of continuous integration and continuous delivery is that it allows you to integrate small pieces of code at one time. These code changes are simpler and easier to handle than huge chunks of code and as such, have fewer issues that may need to be repaired at a later date.

    • Fault Isolations

      Fault isolation refers to the practice of designing systems such that when an error occurs, the negative outcomes are limited in scope. Limiting the scope of problems reduces the potential for damage and makes systems easier to maintain.

    • Faster Mean Time to Resolution (MTTR)

      MTTR measures the maintainability of repairable features and sets the average time to repair a broken feature. It helps you track the amount of time spent to recover from a failure.

    • More Test Reliability

      Using CI/CD, test reliability improves due to the bite-size and specific changes introduced to the system, allowing for more accurate positive and negative tests to be conducted. Test reliability within CI/CD can also be considered Continuous Reliability. With the continuous merging and releasing of new products and features, knowing that quality was top of mind throughout the entire process assures stakeholders their investment is worthwhile.

    • Faster Release Rate

      Failures are detected faster and as such, can be repaired faster, leading to increasing release rates. However, frequent releases are possible only if the code is developed in a continuously moving system.

    • Smaller Backlog

      Incorporating CI/CD into your organization’s development process reduces the number of non-critical defects in your backlog. These small defects are detected prior to production and fixed before being released to end-users.

    • Customer Satisfaction

      The advantages of CI/CD do not only fall into the technical aspect but also in an organization scope. The first few moments of a new customer trying out your product is a make-or-break-it moment.

    • Increase Team Transparency and Accountability

      CI/CD is a great way to get continuous feedback not only from your customers but also from your own team. This increases the transparency of any problems in the team and encourages responsible accountability.

    • Reduce Costs

      Automation in the CI/CD pipeline reduces the number of errors that can take place in the many repetitive steps of CI and CD. Doing so also frees up developer time that could be spent on product development as there aren’t as many code changes to fix down the road if the error is caught quickly. Another thing to keep in mind: increasing code quality with automation also increases your ROI.

    • Easy Maintenance and Updates

      Maintenance and updates are a crucial part of making a great product. However, it’s important to note within a CI/CD process to perform maintenance during downtime periods, also known as the non-critical hour. Don’t take the system down during peak traffic times to update code changes.

  3. What is meant by CI-CD?

    • CI/CD is a method to frequently deliver apps to customers by introducing automation into the stages of app development. The main concepts attributed to CI/CD are continuous integration, continuous delivery, and continuous deployment.
  4. What is Jenkins Pipeline?

    • Jenkins Pipeline (also known as "Pipeline") is a collection of plugins that enables the integration of continuous delivery pipelines into Jenkins.
  5. How do you configure the job in Jenkins?

    • To configure job in Jenkins, follow the steps:

      • first open the Jenkins portal and click on New Job.

      • After that enter the name of the project and select the type of job and click OK to continue.

      • On the next page, fill up the details as per requirements and click on Save and the job will be created.

  6. Where do you find errors in Jenkins?

    • In Jenkins there are multiple ways to find errors.

      • First on the build's status page and

      • Second is console output page where errors are elaborated.

  7. In Jenkins how can you find log files?

    • Generally, the log files are located at system's /var/log/jenkins/jenkins path.
  8. Jenkins workflow and write a script for this workflow?

    • Jenkins Workflow is a plugin that provides a suite of plugins that allows defining Jenkins continuous delivery pipelines using code as a script. The Jenkinsfile is written using a syntax based on the Groovy language and can include multiple stages, such as build, test, and deploy.

        pipeline { 
            agent any 
             stages { 
                stage('Build') { 
                    steps { 
                        echo 'Building..' 
                    } 
                } 
                stage('Test') { 
                    steps { 
                        echo 'Testing..' 
                    } 
                } 
                stage('Deploy') { 
                    steps { 
                        echo 'Deploying....' 
                    } 
                } 
            } 
        }
      
  9. How to create continuous deployment in Jenkins?

    • To create continues development in Jenkins, follow the steps below.

      • Create a new job(project).

      • Give a name and select type such as freestyle or pipeline.

      • Setup source code management such as GitHub.

      • Define build and deployment steps.

      • Save project.

      • Build the project.

  10. How to build a job in Jenkins?

* To build a job in Jenkins, a job must be configured. Next, on the status page there is an option called "Build Now" Click on that. After clicking, the job will start building.

  1. Why do we use a pipeline in Jenkins?

* We use a pipeline in Jenkins because it allows us to define a complete list of events that happen in the code lifecycle. Starting from the build, to testing and deployment. We can use a set of plugins that help in the implementation of certain processes as a ci/cd pipeline.

  1. Is only Jenkins enough for automation?

* Yes, Jenkins is enough for automation. Jenkins has features of continuous integration, continuous deployment and continuous delivery which are used for the automation of projects. Although Jenkins is old and there are competitors in the market, it is still compatible as well as considered powerful to handle complex projects and pipelines. Therefore, Jenkins is sufficient and helpful for automation.

  1. How will you handle secrets?

* For handling credentials, I will use the Environment Injector plugin and in-built credentials system. Because our username, password or API needs to be private, with the Environment Injector plugin I can wrap the credentials into the environmental variables. As a result, these variables can be used for GitHub, docker etc. logins secretly.

  1. Explain diff stages in CI-CD setup.

* Different stages in ci/cd configuration are explained in the following steps.

* Source: Fetch the source code from source code management.

* Build: Build the code.

* Test: Test the code.

* Deploy: Deploy the project in the production environment.

  1. Name some of the plugins in Jenkin.

* Git: Provides access to GitHub as an SCM which acts as a repository browser for many other providers.

* Kubernetes: Another widely used plugin in Jenkins. It allows you to run all the dynamic agents in a Kubernetes cluster.

* Docker: enables you to create Docker containers and automatically run builds on them.

* Jenkins Pipeline: This plugin provides a powerful way to define and orchestrate complex workflows in Jenkins using a domain-specific language (DSL).

* Jenkins GitHub plugin: This plugin provides integration with GitHub, allowing you to trigger builds and deployments based on events such as pull requests, commits, or tags.

* Jenkins Slack plugin: This plugin allows Jenkins to send notifications and alerts to Slack channels, keeping your team informed about build and deployment status.