Dev Learning Lab

The labs on this site need JavaScript to run. The same content is written out below.

Learn › Architecture and operations › Deployment and operations

CI/CD pipelines

You push code, and a machine checks and deploys it for you

Why it exists — If code changed by several people is combined all at once only now and then, conflicts between the changes show up late, and code that works only on a developer's PC can go out to the production server as it is. CI/CD runs the build, tests, and deployment by a fixed procedure in a clean build environment every time code is pushed, so the change that caused a problem is found right after it is pushed.

Where it's used today — When a Pull Request is opened, GitHub Actions or Jenkins runs the build and tests, and the repository is set up so that the change can be merged into the main branch only if they pass. After the merge, the process continues through creating a Docker image and deploying it to a server or Kubernetes, and if applying to production needs a person's confirmation, only the step just before deployment is left as a manual approval.

Between changing code and getting it onto the production server, there are steps: build, test, package, and deploy. When people do these steps by hand, they skip some, or each person does them differently.

Conceptual model · A conceptual model (not checked against real tools)

Concepts in this lab

CI/CD
CI (continuous integration) means merging code changes often and automatically running a build and tests on every merge to find problems early. CD (continuous delivery or continuous deployment) means using an automated process to get verified code into a deployable state or to deploy it all the way to production. Automating the build, test, and deployment work that people used to do by hand reduces mistakes and shortens the release cycle.
Unit tests and integration tests
A unit test verifies the behavior of a single method or class in isolation from other parts. It runs fast and makes the cause of a failure easy to find. An integration test actually connects several components (such as the Spring container and a database) and verifies that they work together. It is closer to reality but slow. The usual approach is to have many unit tests and to keep integration tests focused on the core flows.
Code review and pull requests
Why it exists — If everyone pushes changes straight to the base branch, others use that code without knowing what changed, and mistakes show up only after they reach production. A pull request adds a step before merging in which you see the changes on one screen, exchange opinions in comments, and check the automated test results.
Where it's used today — On GitHub and GitLab (where it is called a Merge Request), you protect the base branch so that only changes with review approval can be merged, and sometimes a CODEOWNERS file automatically sets who reviews each path. So that reviews do not drag on, split the work so that one pull request is a small change of about one feature.
A pull request (PR) is a request to merge the changes on a working branch into the base branch. Code review is the process in which other developers examine the changes before they are merged. It finds defects early, keeps the code consistent, and shares knowledge within the team.
Health check (liveness, readiness)
Why it exists — If you do the check in only one way, the server may be restarted just because the database was briefly slow, or conversely requests keep being sent to a server that cannot take requests. Separating liveness and readiness lets you decide separately whether to restart it and whether to send requests.
Where it's used today — Have Kubernetes' livenessProbe and readinessProbe call Spring Boot Actuator's /actuator/health/liveness and /actuator/health/readiness, and for an application that takes a long time to start, add a startupProbe so that it is not restarted while it is starting.
A periodic check of whether a server is healthy. Liveness checks whether the process is alive, so that it is restarted if there is a problem. Readiness checks whether the server is ready to take requests, so that traffic is not sent to a server that is not ready. This keeps requests from reaching a server while it is starting up or shutting down.
Rolling, blue-green, and canary deployments
Ways to deploy a new version without interrupting the service. A rolling deployment replaces servers with the new version a few at a time, in turn. A blue-green deployment prepares a complete, separate environment for the new version and then switches the traffic all at once. A canary deployment applies the new version to only some users first, checks that there are no problems, and then expands it gradually.

Try these

Running with the default settings

  1. The developer builds on their own PC.
  2. The developer was in a hurry and did not run the tests. Whether the tests get run depends on a person's memory and effort.
  3. The built file is copied to the production server and the server is restarted. Only that developer knows what code was uploaded.
  4. An existing feature went to production broken. You find out from reports from users. The developer has to find the cause, find the previous file, and upload it again.

Result of this run

Code

# The developer types this directly on their own PC
./gradlew build -x test      # skips the tests because of a rush
scp build/libs/app.jar prod-server:/app/
ssh prod-server "systemctl restart app"

# No record is left of who uploaded what code, or when

Assumptions of this model

This is a model made to explain the concept, and it is not a result checked by running real CI/CD tools. In "By hand", skipping the tests assumes a common accident; if you run the tests when working by hand, you can catch the same problem. The automatic rollback when the health check fails is the behavior you get when the pipeline and the deployment tool are configured that way. The workflow in the code is an example to show the structure; steps that real use needs, such as authentication and caching, are left out. The major versions actions/checkout@v7 and actions/setup-java@v6 in the workflow were checked on 2026-10-26 against the usage examples in the README of the GitHub repository of each action (github.com/actions/checkout, github.com/actions/setup-java). The setup-java README calls v6 the latest stable release and marks v1 through v4 as deprecated, telling you to upgrade to v6.

Previous lab: Gateway and gradual migration · Next lab: Deployment strategies

Concepts in this lab

What this lab shows

Settings

Code


      
    

Diagram

Run comparison

Try these