All topics

CI/CD interview questions

71 questions, 68 with answers. 4,461 open jobs in India ask for CI/CD.

  1. What problem does CI/CD solve in software development?

    CI/CD solves the problem of unreliable and slow software delivery. In traditional development, teams integrate code late, rely heavily on manual testing, and treat releases as high-risk events. This often leads to last-minute failures, rollbacks, and delayed business value.

    CI/CD introduces an automated and repeatable process where code changes are integrated early, validated through automated checks, and prepared for release continuously. This reduces integration issues, improves release confidence, and allows organisations to deliver features and fixes to customers faster while maintaining quality and stability.

    From Tech Vault (Apache 2.0)

  2. What is meant by Continuous Integration?

    Continuous Integration is the practice of frequently merging code changes into a shared version control system, usually several times a day. Each change triggers an automated process that builds the application and runs a defined set of tests.

    The goal is to validate that the codebase remains in a working state at all times. By enforcing consistent formatting, build rules, and test execution through pipeline configuration, teams catch errors early and avoid large, difficult integrations later in the cycle.

    From Tech Vault (Apache 2.0)

  3. What is meant by Continuous Delivery?

    Continuous Delivery means that every code change which passes the pipeline is automatically prepared for release. The application is packaged, tested, and deployed to environments such as staging in a consistent and repeatable way.

    Releases become a business decision rather than a technical challenge. The codebase is always in a deployable state, and deploying to production is a controlled action, often triggered by an approval step rather than additional development work.

    From Tech Vault (Apache 2.0)

  4. What is meant by Continuous Deployment?

    Continuous Deployment is an extension of Continuous Delivery where changes that pass all pipeline stages are deployed to production automatically.

    This relies on strong test coverage, reliable pipeline syntax, clear environment configuration, and monitoring. Because deployments are frequent and incremental, failures are easier to detect and isolate. This approach is common in mature systems where rapid feedback and fast iteration are critical.

    From Tech Vault (Apache 2.0)

  5. Why is automated testing important in CI/CD?

    Automated testing provides the confidence required to release software frequently. Each test validates a specific aspect of the system, such as business logic, integration between services, or user workflows.

    Tests are executed automatically as part of the pipeline using predefined scripts and configuration files. This ensures consistency, removes manual bottlenecks, and prevents regressions from reaching production. From a business standpoint, it reduces the risk of outages, protects customer trust, and lowers the cost of fixing defects.

    From Tech Vault (Apache 2.0)

  6. What is a build and what is a build artefact?

    A build is the process of converting source code into a deployable format. This may include compiling, resolving dependencies, running build scripts, and applying configuration.

    A build artefact is the output of this process, such as a compiled binary, a package file, or a container image. Artefacts are versioned and stored so the same package can be promoted across environments, ensuring consistency between testing and production.

    From Tech Vault (Apache 2.0)

  7. What is a CI/CD pipeline and what are its typical stages?

    A CI/CD pipeline is an automated, repeatable workflow that takes source code from version control and delivers it into a running environment. It is usually defined as code using configuration files, commonly YAML, which allows the pipeline itself to be versioned, reviewed, and reused.

    Typical stages include:

    • Source: code checkout triggered by a commit or pull request
    • Build: compilation and dependency resolution
    • Static analysis: linting, formatting, and security or quality checks
    • Test: automated unit, integration, and sometimes end-to-end tests
    • Package: creation and versioning of build artefacts such as binaries or container images
    • Deploy: automated deployment to staging or production environments
    • Post-deployment: smoke tests, health checks, and monitoring validation

    CI/CD pipelines enforce consistency, reduce manual errors, and provide visibility and traceability across the software delivery lifecycle.

    From Tech Vault (Apache 2.0)

  8. What happens if a pipeline fails?

    When a pipeline fails, execution stops immediately and the failure is reported. This prevents invalid or unstable code from progressing to later stages such as deployment.

    Failures are logged with clear output, allowing developers to identify issues such as test failures, syntax errors, misconfigured environment variables, or broken dependencies. Early failure is intentional and protects production systems while encouraging fast correction.

    From Tech Vault (Apache 2.0)

  9. How does Git integrate with CI/CD?

    Git acts as the entry point for CI/CD. Events such as commits, pull requests, or merges trigger the pipeline automatically.

    Branching strategies, commit history, and pull request reviews integrate directly with pipeline rules. This ensures that only code that meets defined quality checks and formatting standards can be merged and released. Git also provides traceability, making it easy to link deployments back to specific changes.

    From Tech Vault (Apache 2.0)

  10. How does CI/CD help teams release faster?

    CI/CD reduces manual work and waiting time by automating validation and deployment steps. Code changes are small, well-tested, and consistently packaged, which makes them easier to release.

    Because pipelines run on every change, feedback is immediate. Teams spend less time fixing late-stage issues and more time delivering value. Faster releases also mean quicker responses to customer feedback and changing business requirements.

    From Tech Vault (Apache 2.0)

  11. What environments are used in CI/CD and why?

    CI/CD commonly uses multiple environments such as development, test, staging, and production. Each environment has its own configuration and purpose.

    This separation allows teams to validate behaviour, configuration, and performance safely before exposing changes to users. It also ensures that environment-specific settings such as secrets, URLs, and scaling rules are managed correctly.

    From Tech Vault (Apache 2.0)

  12. What is a deployment strategy?

    A deployment strategy defines how new application versions are rolled out to users. It focuses on availability, rollback capability, and risk control.

    Different strategies balance speed and safety in different ways, allowing teams to align deployment behaviour with business priorities and system criticality.

    From Tech Vault (Apache 2.0)

  13. Explain blue-green deployment

    Blue-green deployment uses two identical production environments. One serves live traffic while the other hosts the new version.

    After validation, traffic is switched using a load balancer or routing rule. If issues arise, traffic can be switched back immediately. This approach minimises downtime and simplifies rollback.

    From Tech Vault (Apache 2.0)

  14. What is a canary deployment?

    A canary deployment releases a new version to a small portion of users first. Metrics such as error rates and performance are monitored before expanding the rollout.

    This approach limits risk while providing real production feedback. If problems are detected, the rollout can be halted without affecting most users.

    From Tech Vault (Apache 2.0)

  15. What is a rolling deployment?

    A rolling deployment updates instances gradually rather than all at once. Old and new versions run side by side during the rollout.

    This avoids downtime and allows the system to remain available throughout the deployment. It is widely used because it balances simplicity, availability, and control.

    From Tech Vault (Apache 2.0)

  16. Walk me through a CI/CD pipeline, from code commit to production?

    From code commit to production, the CI/CD pipeline starts when a developer pushes code to the remote repository or opens a pull request, which automatically triggers the continuous integration (CI) process.

    The pipeline first runs in the development environment, where the code is checked out, dependencies are resolved, and the application is built. Static checks such as linting and formatting are executed, followed by fast-running unit tests to validate the code in a development context.

    If this stage succeeds, the pipeline packages the application into a versioned artefact, such as a binary or container image, and stores it in an artefact repository. This artefact is built once and then promoted unchanged through subsequent environments.

    Next, as part of continuous delivery (CD), the artefact is deployed to the staging environment, which mirrors production as closely as possible. In staging, integration tests, smoke tests, and health checks are run to verify system behaviour and interactions with external services. Deployment strategies such as rolling or blue–green deployments are commonly used to reduce risk.

    After successful validation in staging, and often following a manual approval step, the same artefact is deployed to the production environment. The deployment is monitored using logs, metrics, and alerts, and automated rollback mechanisms are in place if any issues are detected.

    This pipeline enforces a clear separation between development, staging, and production environments while ensuring consistency, traceability, and a controlled release process from code commit to production.

    From Tech Vault (Apache 2.0)

  17. Your CI pipeline fails during the automated test stage after a code change. How would you investigate the failure, and what does this situation tell you about the role of CI in a development team?

    When a CI pipeline fails during automated testing, the first step is to review the pipeline logs to identify which tests failed and understand the error messages. I would check whether the failure is due to a genuine code regression, a flaky test, or an environmental issue. Reproducing the failure locally or in a controlled test environment helps confirm the root cause. From a CI perspective, this situation demonstrates the value of early feedback and that the pipeline is doing its job by preventing defective code from progressing further in the delivery process. Rather than seeing the failure as a blocker, it should be treated as a safety mechanism that protects the shared codebase and reduces downstream risk. Once the issue is fixed, rerunning the pipeline ensures confidence that the change is safe to merge.

    From Tech Vault (Apache 2.0)

  18. In a team where many developers commit and merge changes frequently, the main branch becomes unstable. How would you use CI/CD practices to improve stability and collaboration?

    In a high-commit environment, an unstable main branch usually means changes are being integrated without enough automated validation. To address this, I would use CI/CD to introduce strong quality gates before code reaches the main branch. This starts with running automated builds and tests on every pull request so that issues are detected early, before merging.

    I would also enforce branch protection rules that require the CI pipeline to pass and, if applicable, require peer reviews before merging. This prevents broken or incomplete changes from being integrated. Encouraging small, frequent commits helps reduce the risk of conflicts and makes failures easier to identify and fix.

    From a collaboration standpoint, fast and reliable CI feedback is critical. Developers quickly see whether their change is safe, take ownership of fixing failures, and avoid blocking others. Overall, CI/CD helps keep the main branch in a continuously deployable state while improving team confidence and development velocity.

    From Tech Vault (Apache 2.0)

  19. A CI/CD pipeline succeeds, but the application fails when deployed to the staging environment. What are the likely causes, and how would you handle it?

    When a pipeline passes in CI but fails in staging, it usually indicates a difference between environments rather than a problem with the code itself. Common causes include missing or incorrect environment variables, misconfigured secrets, infrastructure differences, or deployment scripts that behave differently outside the CI environment.

    To handle this, I would start by reviewing deployment and application logs in staging, then verify configuration values and infrastructure dependencies. I would also compare staging and CI environments to identify mismatches. This situation highlights why environment parity is important in CI/CD — staging should closely resemble production so issues are caught earlier. Improving configuration management and standardizing environments helps reduce these failures over time.

    From Tech Vault (Apache 2.0)

  20. Explain a simple Continuous Integration pipeline.Basic
    • clone repository
    • deploy stage (QA)
    • testing environment (QA)
    • deploy stage (PROD)

    From Test your Sysadmin Skills (MIT)

  21. Is it ok to run Docker from inside Docker?

    Running Docker inside Docker (a.k.a. DinD), while possible, should be avoided, if at all possible. (Source provided below.) Instead, you want to set up a way for your main container to produce and communicate with sibling containers.

    Jérôme Petazzoni — the author of the feature that made it possible for Docker to run inside a Docker container — actually wrote a blog post saying not to do it. The use case he describes matches the OP's exact use case of a CI Docker container that needs to run jobs inside other Docker containers.

    Petazzoni lists two reasons why DinD is troublesome:

    1. It does not cooperate well with Linux Security Modules (LSM).
    2. It creates a mismatch in file systems that creates problems for the containers created inside parent containers.

    From that blog post, he describes the following alternative:

    [The] simplest way is to just expose the Docker socket to your CI container, by bind-mounting it with the -v flag.

    Simply put, when you start your CI container (Jenkins or other), instead of hacking something together with Docker-in-Docker, start it with:

    docker run -v /var/run/docker.sock:/var/run/docker.sock ...
    

    Now this container will have access to the Docker socket, and will therefore be able to start containers. Except that instead of starting "child" containers, it will start "sibling" containers.

    From Stack Overflow: asked by Johan, answered by predmijat (CC BY-SA 4.0)

  22. What is the JUnit XML format specification that Hudson supports?

    I did a similar thing a few months ago, and it turned out this simple format was enough for Hudson to accept it as a test protocol:

    <testsuite tests="3">
        <testcase classname="foo1" name="ASuccessfulTest"/>
        <testcase classname="foo2" name="AnotherSuccessfulTest"/>
        <testcase classname="foo3" name="AFailingTest">
            <failure type="NotEnoughFoo"> details about failure </failure>
        </testcase>
    </testsuite>
    

    This question has answers with more details: Spec. for JUnit XML Output

    From Stack Overflow: asked by Vlad Krylov, answered by Anders Lindahl (CC BY-SA 3.0)

  23. Jenkins pipeline: agent vs node?

    The simple answer is, Agent is for declarative pipelines and node is for scripted pipelines.

    In declarative pipelines the agent directive is used for specifying which agent/slave the job/task is to be executed on. This directive only allows you to specify where the task is to be executed, which agent, slave, label or docker image.

    On the other hand, in scripted pipelines the node step can be used for executing a script/step on a specific agent, label, slave. The node step optionally takes the agent or label name and then a closure with code that is to be executed on that node.

    declarative and scripted pipelines (edit based on the comment):

    • declarative pipelines is a new extension of the pipeline DSL (it is basically a pipeline script with only one step, a pipeline step with arguments (called directives), these directives should follow a specific syntax. The point of this new format is that it is more strict and therefore should be easier for those new to pipelines, allow for graphical editing and much more.
    • scripted pipelines is the fallback for advanced requirements.

    From Stack Overflow: asked by Matthias M, answered by Jon S (CC BY-SA 4.0)

  24. What is the effect of @NonCPS in a Jenkins pipeline script?

    The exception that you are seeing is due to script security and sandboxing. Basically, by default, when you run a pipeline script, it runs in a sandbox which only allow usage of certain methods and classes. There are ways to whitelist operations, check the link above.

    The @NonCPS annotation is useful when you have methods which use objects which aren't serializable. Normally, all objects that you create in your pipeline script must be serializable (the reason for this is that Jenkins must be able to serialize the state of the script so that it can be paused and stored on disk).

    When you put @NonCPS on a method, Jenkins will execute the entire method in one go without the ability to pause. Also, you're not allowed to reference any pipeline steps or CPS transformed methods from within an @NonCPS annotated method. More information about this can be found here.

    As for the exception handling: Not 100% sure what you are experiencing; I've tried the following and it works as expected:

    @NonCPS
    def myFunction() {
        throw new RuntimeException();
    }
    try {
        myFunction();
    } catch (Exception e) {
        echo "Caught";
    }
    

    and

    @NonCPS
    def myFunction() {
        throw new RuntimeException();
    }
    def mySecondFunction() {
        try {
            myFunction();
        } catch (Exception e) {
            echo "Caught";
        }
    }
    mySecondFunction();
    

    and finally:

    @NonCPS
    def myFunction() {
        throw new RuntimeException();
    }
    @NonCPS
    def mySecondFunction() {
        try {
            myFunction();
        } catch (Exception e) {
            echo "Caught";
        }
    }
    mySecondFunction();
    

    All print "Caught" as expected.

    From Stack Overflow: asked by bsky, answered by Jon S (CC BY-SA 3.0)

  25. Is there a way to keep Hudson / Jenkins configuration files in source control?

    Most helpful Answer

    There is a plugin called SCM Sync configuration plugin.

    Original Answer

    Have a look at my answer to a similar question. The basic idea is to use the filesystem-scm-plugin to detect changes to the xml-files. Your second part would be committing the changes to SVN.

    EDIT: If you find a way to determine the user for a change, let us know.

    EDIT 2011-01-10 Meanwhile there is a new plugin: SCM Sync configuration plugin. Currently it only works with subversion and git, but support for more repositories is planned. I am using it since version 0.0.3 and it worked good so far.

    From Stack Overflow: asked by Yuval Roth, answered by Peter Schuetze (CC BY-SA 4.0)

  26. Hudson vs Jenkins in 2012

    In terms of stability, for over a year Jenkins has offered a Long-Term Support (LTS) version for people who want to be more assured about the stability and support of the software they're installing.

    Every three months or so, a previous release is selected which has been deemed as working well by the community of Jenkins users. This version is then branched, any important fixes (which have been "battle-tested") are backported into this Jenkins version, and then this release gets extra testing by various people and companies. Once it's ready for release, this becomes the new LTS version.

    As new high-priority fixes come along, these are backported to the LTS version.

    Numerous large users of Jenkins stick to the LTS line of releases, and according to the public Jenkins usage statistics, several thousand deployments are using it.

    This should mean the LTS version you are downloading is even more stable than a random version chosen from the usual weekly release line.

    Beyond the statistics, the situation regarding Jenkins usage, community size, its level of development, rate of new features added, number of new plugins and mailing list activity in comparison to Hudson doesn't seem to have changed (i.e. Jenkins remains ever-further ahead).

    Basically, most of the points made in this previous discussion still apply, though the initial corporate support of Hudson appears to have subsided a little.

    From Stack Overflow: asked by Volodymyr Bezuglyy, answered by Christopher Orr (CC BY-SA 3.0)

  27. GitLab CI vs. Jenkins

    This is my experience:

    At my work we manage our repositories with GitLab EE and we have a Jenkins server (1.6) running.

    In the basis they do pretty much the same. They will run some scripts on a server/Docker image.

    TL;DR;

    • Jenkins is easier to use/learn, but it has the risk to become a plugin hell
    • Jenkins has a GUI (this can be preferred if it has to be accessible/maintainable by other people)
    • Integration with GitLab is less than with GitLab CI
    • Jenkins can be split off your repository

    Most CI servers are pretty straight forward (concourse.ci, gitlab-ci, circle-ci, travis-ci, drone.io, gocd and what else have you). They allow you to execute shell/bat scripts from a YAML file definition. Jenkins is much more pluggable, and comes with a UI. This can be either an advantage or disadvantage, depending on your needs.

    Jenkins is very configurable because of all the plugins that are available. The downside of this is that your CI server can become a spaghetti of plugins.

    In my opinion chaining and orchestrating of jobs in Jenkins is much simpler (because of the UI) than via YAML (calling curl commands). Besides that Jenkins supports plugins that will install certain binaries when they are not available on your server (don't know about that for the others).

    Nowadays (Jenkins 2 also supports more "proper ci" with the Jenkinsfile and the pipline plugin which comes default as from Jenkins 2), but used to be less coupled to the repository than i.e. GitLab CI.

    Using YAML files to define your build pipeline (and in the end running pure shell/bat) is cleaner.

    The plug-ins available for Jenkins allow you to visualize all kinds of reporting, such as test results, coverage and other static analyzers. Of course, you can always write or use a tool to do this for you, but it is definitely a plus for Jenkins (especially for managers who tend to value these reports too much).

    Lately I have been working more and more with GitLab CI. At GitLab they are doing a really great job making the whole experience fun. I understand that people use Jenkins, but when you have GitLab running and available it is really easy to get started with GitLab CI. There won't be anything that will integrate as seamlessly as GitLab CI, even though they put quite some effort in third-party integrations.

    • Their documentation should get you started in no time.
    • The threshold to get started is very low.
    • Maintenance is easy (no plugins).
    • Scaling runners is simple.
    • CI fully part of your repository.
    • Jenkins jobs/views can get messy.

    Some perks at the time of writing:

    • Only support for a single file in the community edition. Multiples files in the enterprise edition.

    From Stack Overflow: asked by Ravikiran butti, answered by Rik (CC BY-SA 4.0)

  28. How to restart Jenkins manually?

    To restart Jenkins manually, you can use either of the following commands (by entering their URL in a browser):

    (jenkins_url)/safeRestart - Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.

    (jenkins_url)/restart - Forces a restart without waiting for builds to complete.

    From Stack Overflow: asked by Kerry Jones, answered by Željko Filipin (CC BY-SA 4.0)

  29. Change email address in Git

    Locally set email-address (separately for each repository)

    1. Open Git Bash.

    2. Change the current working directory to the local repository in which you want to set your Git config email.

    3. Set your email address with the following command:

    git config user.email "your_email@abc.example"
    
    1. Confirm that you have set your email address correctly with the following command.
    git config user.email
    

    Globally set email-address (only used when nothing is set locally)

    1. Open Git Bash.

    2. Set your email address with the following command:

    git config --global user.email "your_email@abc.example"
    
    1. Confirm that you have set your email address:
    git config --global user.email
    

    Or using environment variables

    1. GIT_COMMITTER_EMAIL=your_email@abc.example
    2. GIT_AUTHOR_EMAIL=your_email@abc.example

    PD: Info from GitHub official guide

    From Stack Overflow: asked by mani_nz, answered by Marc (CC BY-SA 4.0)

  30. How to choose between Hudson and Jenkins?

    Use Jenkins.

    Jenkins is the recent fork by the core developers of Hudson. To understand why, you need to know the history of the project. It was originally open source and supported by Sun. Like much of what Sun did, it was fairly open, but there was a bit of benign neglect. The source, trackers, website, etc. were hosted by Sun on their relatively closed java.net platform.

    Then Oracle bought Sun. For various reasons Oracle has not been shy about leveraging what it perceives as its assets. Those include some control over the logistic platform of Hudson, and particularly control over the Hudson name. Many users and contributors weren't comfortable with that and decided to leave.

    So it comes down to what Hudson vs Jenkins offers. Both Oracle's Hudson and Jenkins have the code. Hudson has Oracle and Sonatype's corporate support and the brand. Jenkins has most of the core developers, the community, and (so far) much more actual work.

    Read that post I linked up top, then read the rest of these in chronological order. For balance you can read the Hudson/Oracle take on it. It's pretty clear to me who is playing defensive and who has real intentions for the project.

    From Stack Overflow: asked by Greg Domjan, answered by chmullig (CC BY-SA 3.0)

After the last page: 3 questions more, without answers. Go to the last page

Related topics

Where these questions come from

Open-source collections on GitHub, official documentation, a government careers service and the Stack Exchange sites, each used under its own licence. The answers are the authors' own words: we only tidy the layout, leave out pictures, and cut a long answer with a link to the rest. Stack Exchange answers stay under CC BY-SA and name who asked and who answered.