Day 29: Important Jenkins Questions to Prepare for DevOps Engineer Interviews

Day 29: Important Jenkins Questions to Prepare for DevOps Engineer Interviews

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

    • Continuous Integration (CI)

      To automatically build, test and integrate code changes into the shared repository is known as CI. It helps identify and fix integration issues early, ensuring that code is always working.

    • Continuous Delivery (CD)

      To automate the process of packaging, testing and preparing code changes for deployment to a production-like environment is known as CD. It reduces the risk of deployment errors and provides a consistent process for moving code changes closer to production.

    • Continuous Deployment (CD)

      Automating the release of code changes directly to production without manual interaction is known as continuous deployment. It ensures that the code changes reach users quickly and are responsive to the development environment.

  2. Benefits of CI/CD

    • CI/CD automate the process of build, testing and deployment process, significantly reducing the time needed to deliver new features or fixes.

    • Automated testing in the CI/CD pipeline ensures that code changes are thoroughly tested, leading to fewer bugs and improved code quality.

    • CI detects integration issues and bugs as soon as code is committed, allowing for immediate fixes and preventing issues from escalating.

    • CD ensures that deployments are consistent and repeatable across various environments, reducing configuration-related errors.

  3. What is meant by CI-CD?

    CI/CD stands for Continuous Integration and Continuous Delivery/Deployment, and it represents a set of modern software development practices and methodologies that aim to automate and streamline the process of building, testing, and deploying software applications.

  4. What is Jenkins Pipeline?

    Jenkins Pipeline is a suite of plugins in Jenkins that allows you to define and automate the entire software delivery process, from building and testing to deploying and monitoring, using a domain-specific language (DSL) based on Groovy. It provides a way to create, manage, and visualize your continuous delivery (CD) pipelines as code.

  5. How do you configure the job in Jenkins?

    Configuring a job in Jenkins involves several steps, and the exact configuration may vary depending on the type of job you want to create (e.g., Freestyle project, Pipeline).

    Here are steps to configure the job in Jenkins:

    • Access the Jenkins server and click on "Create a new Job".

    • Inside the job, you'll find various sections to configure your job. You can add descriptions, build triggers and discard old builds.

    • If your project is version-controlled, configure the SCM section. Choose your version control system (Git, Subversion. etc.) and provide repository URL and credentials if required.

    • Specify when you want the job to run. Common trigger includes polling the SCM for changes, scheduled builds, or triggering builds manually.

    • Click the "Add Build Step" button and choose from various build steps, such as executing shell commands, running Windows batch commands, or invoking other build tools.

    • You can trigger a build manually by clicking the "Build Now" button on the job's dashboard page or set up an automatic trigger based on your defined build triggers.

  6. Where do you find errors in Jenkins?

    • Console Output

      When your build gets failed due to some errors and you don't know what the error is. Simply, click on the failed job. There will be a lot of options on the left sidebar. Go to Console Output. Here you will find the errors.

    • Build History

      Build history on the Jenkins dashboard provides the summary for your build. A failed build is highlighted with the red 'X', making it easy to identify the failed build. Click on a failed build in the build history will take you to the build page where you can access the console output to investigate the errors.

  7. In Jenkins how can you find log files?

    There are many ways to check the logs in Jenkins.

    • Console output can show you logs of your build and errors.

    • Workspace file can show you all the files generated and used by the job including the logs file.

    • If you are using Jenkins agents to run builds, each agent has its logs. The location of these log files can vary depending on how Jenkins agents are set up on your instruction.

  8. Jenkins workflow and write a script for this workflow?

    Jenkins workflow is also known as Jenkins pipeline. It is a very powerful feature that allows you to define complex build and deployment processes as code. You can create custom workflows using Domain-specific Language (DSL) known as Groovy within the Jenkinsfile.

    Here's the simple Jenkins pipeline:

     pipeline {
         agent any  
         stages {
             stage('Checkout') {
                 steps {
                     // Check out your source code from a version control system (e.g., Git)
                     checkout scm
             stage('Build') {
                 steps {
                     echo "code is cloned"
             stage('Test') {
                 steps {
                    echo "code is tested"
  9. How to create a continuous deployment in Jenkins?

    Here are the simple steps to create a deployment in Jenkins:

    • Set up your Jenkins server by installing Java first and Jenkins in your system.

    • Install the docker and docker-compose in your system as well.

    • Add Jenkins and user (ubuntu) to the docker group.

    • Install the required plugins in your Jenkins server.

    • Create a job. Give your job a name and write the description for your job as well.

    • Select Git and paste the URL of your project.

    • Enable the GitHub trigger SCM polling and add a webhook in your project repository.

    • Write the pipeline for your project. Here is the simple pipeline you can use to build, test and deploy.

        pipeline {
            agent any
                    echo "code is cloned"
                    echo "code is built"
                    echo "code is deployed"
    • Customize the pipeline as you need. Click on Save and Build now to run your pipeline.

    • The build will run automatically when a change happens within the code without any manual interaction or click on build now every time you need to build.

  10. How to build a job in Jenkins?

    Here are the simple steps to build a job in Jenkins:

    • Access your Jenkins server and click on Create a job.

    • Select the job type whether it's a freestyle project or a pipeline project. Select according to your needs.

    • Give your job a name.

    • Write the description for your job.

    • Select Git, if your project is version-controlled.

    • Add SCM polling if needed.

    • Write the execute shell or pipeline as required for your project.

    • Click on Save and Build Now.

    • On the bottom of your left sidebar, you can see the process of building the job.

    • You can check the output of the job by clicking on the job and going to the console output.

  11. Why do we use a pipeline in Jenkins?

    • To automate the process of build, test and deploy the code.

    • To automatically build the code whenever changes happen within the code through the version control system.

    • It provides flexibility for your build and deployment workflows. You can customise the pipeline according to your needs.

    • Pipeline is defined as code using the Jenkinsfile, which can be stored alongside your application code in version control (GitHub).

    • Jenkins pipelines are suitable for projects of all sizes. They scale well, whether you are building a small application or a large application.

  12. Is Only Jenkins enough for automation?

    Jenkins is a powerful automation tool, particularly well-suited for continuous integration and continuous delivery (CI/CD). However, whether Jenkins alone is enough for automation depends on the specific automation needs and requirements of your organization or project.

  13. How will you handle secrets?

    Handling secrets securely is a critical aspect of DevOps and automation. Here are some common practices for handling secrets in an automated environment:

    • Utilize dedicated secret management tools like HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault.

    • Store secrets as environment variables on the target systems or within the automation scripts.

    • Store the encrypted files in version control systems and decrypt them when needed during automation.

    • Leverage configuration management tools like Ansible, Puppet, or Chef to securely manage secrets across multiple servers.

  14. Explain different stages in CI-CD setup

    In CI/CD setup, there are typically several stages, each serving a specific purpose in the software development and deployment. These stages help automate and streamline the delivery pipeline. Here are the common stages for CI/CD:

    • This is where developers write and commit code changes into the version control system (Git).

    • The committed code is stored in a code repository such as GitHub, GitLab, BitBucket etc.

    • In the CI stage, automated builds and processes are triggered whenever the code changes in the version control system. The CI tools like Jenkins, Travis CI or CIcircle are used.

    • Static code analysis tools (e.g. SonarQube) may be integrated to analyze the code for better quality.

    • The deployment pipeline is responsible for deploying the application to different environments (e.g. development, staging, production).

    • In a CD setup, validating changes are automatically deployed to the target environment without manual interaction.

  15. Name some of the plugins in Jenkins.

    Many plugins are usually used in Jenkins for different tasks. But here are some common plugins in Jenkins:

    • Git Plugin

    • GitHub Plugin

    • Docker Plugin

    • Pipeline Plugin

    • Artifactory Plugin

    • SonarQube scanning Plugin

    • BlueOcean Plugin

    • Node js Plugin

    • HTML Publisher Plugin

    • Kubernetes Continuous Deploy Plugin

<That's all for today. Hope you like it. FOLLOW to join me in the journey of DevOps>