> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Continuous Integration Basics

> Overview of continuous integration merge, test, main workflow, CI pipelines, test strategies, platform engineering enablement and metrics to ensure reliable automated software integration.

Welcome. This lesson explains the merge → test → main workflow—the backbone of modern software teams—and lays a practical foundation for platform engineers and developers building reliable CI pipelines.

Continuous integration (CI) reduces integration risk by validating changes upstream so downstream activities become simpler, faster, and more reliable. Historically, teams faced "integration hell": late discovery of breakages, uncertain release status, and friction as developers hesitated to merge changes into the shared codebase.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-problems-slide.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=b2389a00fa301744994531d64274e258" alt="A presentation slide titled &#x22;Need for Continuous Integration&#x22; showing four colored panels. Each panel lists a problem—Integration Hell, Late Discovery, Unknown Status, and Team Friction—with short descriptions about merge conflicts, late bug discovery, uncertain code status, and developers hesitant to share unfinished work." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-problems-slide.jpg" />
</Frame>

## What is Continuous Integration?

Continuous integration means integrate early and integrate often—ideally multiple times per day. Frequent merges produce smaller, easier-to-review changes and much faster feedback loops. In practice, teams protect `main` (or other protected branches) by blocking merges until automated CI checks pass, preventing broken code from entering the shared foundation.

<Callout icon="lightbulb" color="#1CB2FE">
  Continuous integration is both a technical process and a team discipline. Automate validation so developers spend less time debugging integration problems and more time delivering features.
</Callout>

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-integrate-early-often.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=6839dbacd68ee943ed9791593362d85e" alt="A presentation slide titled &#x22;CI Definition – Integrate Early, Integrate Often&#x22; showing three pillars: Continuous, Integration, and Automated. Each pillar has a short description and an icon (circular arrows, team with a gear, and a terminal) explaining frequent integration, combining team code, and automated validation." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-integrate-early-often.jpg" />
</Frame>

## The merge → test → main pattern

Typical merge workflows follow a simple, repeatable pattern:

1. Write code in a feature branch.
2. Push the branch to the shared repository and open a pull request (PR).
3. Run automated tests and checks on the combined code (the PR branch merged with current `main`).
4. Accept or reject the merge based on CI results.

This ensures every change is validated before it becomes part of `main`.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/ci-write-test-merge-timeline.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=fcf597db10c8420ab3b9c6b6035ccfa2" alt="A horizontal timeline titled &#x22;The Fundamental CI Process: Write → Test → Merge&#x22; showing icons and steps: developer writes code locally, pushes to a shared repository, automated tests run, and changes are accepted or sent back for fixes if tests fail." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/ci-write-test-merge-timeline.jpg" />
</Frame>

Without CI, individuals and teams often work in isolation and only discover integration problems late in the cycle. CI replaces the fragile statement “My code works” with the stronger guarantee “Our code works together” by providing an automated, repeatable integration pipeline that protects the team while enabling individual experimentation.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/spr-team-struggles-without-ci.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=f66de20bf37d49b2782551445a885880" alt="A presentation slide titled &#x22;SPR Team Struggles – Life Without Continuous Integration&#x22; showing three team members — Phuong, Alan, and Swati — with icons and brief notes about working in isolation, infrastructure/app conflicts, and not knowing if the system works until deployment." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/spr-team-struggles-without-ci.jpg" />
</Frame>

## Cultural and process shifts with CI

Adopting CI changes how teams operate:

* Weekly integration → daily (or more frequent) merges.
* Hope-based validation → verifiable automated checks.
* Manual validation → reproducible CI pipelines.
* Individual ownership → shared responsibility for quality.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/my-code-to-our-code-integration.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=fb90defbfb86b327127ba82616ecdf9d" alt="A slide titled &#x22;From 'My Code Works' to 'Our Code Works Together' showing four paired transitions. Each pair maps Individual Focus → Team Integration, Weekly Integration → Daily Integration, Hope‑Based Validation → Know It Works, and Manual Validation → Automated Validation." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/my-code-to-our-code-integration.jpg" />
</Frame>

Platform engineers can streamline adoption by providing standard pipelines, out-of-the-box tooling, scalable CI infrastructure, and monitoring so development teams can follow best practices without heavy setup.

## Test strategy and the validation pyramid

CI pipelines commonly structure tests into layers to optimize speed and confidence:

| Layer | Purpose | When to run |
| - | - | - |
| Unit tests | Fast, narrow scope tests providing immediate feedback | On every commit / PR |
| Integration tests | Validate interactions between components (databases, services) | On PR or separate CI stage |
| System / E2E tests | Validate end-to-end behavior in a production-like environment | Nightly, gated stage, or pre-release |

Design pipelines to favor fast unit feedback while running broader integration/system tests in later stages or parallelized runners.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/main-branch-single-source-truth.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=757765e5089f03d194691e4576cbfd28" alt="A presentation slide titled &#x22;Main Branch – The Single Source of Truth&#x22; showing three colored panels labeled &#x22;Shared Foundation,&#x22; &#x22;Always Working,&#x22; and &#x22;Integration Point,&#x22; each with an icon and a short description of the main branch's role in team workflow." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/main-branch-single-source-truth.jpg" />
</Frame>

<Callout icon="warning" color="#FF6B6B">
  Protect the `main` branch. Keep it deployable: require PR reviews, CI gates, and automated checks so `main` remains a reliable single source of truth.
</Callout>

## Feature-branch workflow (recommended)

A simple, practical feature-branch workflow:

* Create a feature branch from `main`:

```bash theme={null}
git checkout -b feature/my-change
```

* Push and open a PR:

```bash theme={null}
git push -u origin feature/my-change
# Open PR in your hosting platform (GitHub, GitLab, Bitbucket)
```

* CI runs tests against the PR; if all checks pass and reviewers approve, merge into `main`.

Enforce policies (protected branch, required checks) to prevent incomplete or failing code from being merged.

## Automated builds: reproducible artifacts

CI should produce consistent, repeatable builds: resolving dependencies, compiling, running static analysis, and packaging artifacts. Reproducible builds eliminate "works on my machine" problems and make rollbacks and deployments predictable.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/automated-builds-compilation-deps-validation.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=7d71e56a435254a56af11106abdc4098" alt="A slide titled &#x22;Automated Builds – From Source Code to Runnable Software&#x22; showing three build stages—1) Compilation, 2) Dependency Resolution, and 3) Validation—with short descriptions, plus a banner noting that consistent builds eliminate &#x22;works on my machine&#x22; problems." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/automated-builds-compilation-deps-validation.jpg" />
</Frame>

### Example: minimal CI job (GitHub Actions)

This simplified example demonstrates running a build and unit tests on a push or PR:

```yaml theme={null}
name: CI
on: [push, pull_request]
jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Node
        uses: actions/setup-node@v4
        with:
          node-version: '18'
      - name: Install dependencies
        run: npm ci
      - name: Run unit tests
        run: npm test
```

## Fast feedback and batch size

Fast feedback is critical. Small batches and quick CI results help developers retain context and fix issues immediately. Delayed CI increases context switching and the cost of fixes.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/fast-ci-feedback-immediate-delayed-late.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=a657567a0be83f392d0ff7b41416d7aa" alt="A presentation slide titled &#x22;Speed Matters – Criticality of Fast CI Feedback&#x22; showing three colored boxes: Immediate (minutes), Delayed (hours), and Late (days). Each box lists consequences (immediate = easy to fix, delayed = harder/context switching, late = very expensive/major rework)." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/fast-ci-feedback-immediate-delayed-late.jpg" />
</Frame>

## Team benefits and platform enablement

CI improves teamwork by increasing visibility, confidence, and shared responsibility. A solid platform lets developers (Phuong), infrastructure engineers (Alan), and platform owners (Swati) operate with less stress and higher throughput.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/ci-teamwork-visibility-confidence-communication-responsibility.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=2ff997ace00d96923d5a963796c10ab7" alt="A presentation slide titled &#x22;How CI Enables Better Teamwork&#x22; showing four colored cards that list team benefits: Visibility, Confidence, Communication, and Shared Responsibility, each with a short caption and icon." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/ci-teamwork-visibility-confidence-communication-responsibility.jpg" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/spr-team-ci-slide-avatars.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=00459253d279f31af00adaf9647906a7" alt="A presentation slide titled &#x22;SPR Team Success – Life With Continuous Integration&#x22; showing three colored avatar icons labeled Phuong, Alan, and Swati with short role descriptions underneath each." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/spr-team-ci-slide-avatars.jpg" />
</Frame>

Platform engineering responsibilities include:

* Standardized pipelines and templates for common languages and frameworks.
* Tool provisioning and managed CI runners (e.g., self-hosted runners, autoscaling agents).
* Observability and metrics to monitor CI health.
* Documentation and onboarding to remove knowledge gaps.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/platform-engineering-ci-cards.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=9f97b47aaa745738f5ad51f33d0497d9" alt="A presentation slide titled &#x22;Platform Engineering – Making CI Easy for Development Teams&#x22; showing three cards: Standardized Pipelines, Tool Provisioning, and Monitoring with brief descriptions. Each card has a circular icon (orange, pink, green) and the slide includes a small Copyright KodeKloud notice." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/platform-engineering-ci-cards.jpg" />
</Frame>

## Common CI challenges and mitigation

Typical challenges and platform responses:

| Challenge | Platform solution |
| -: | - |
| Slow tests | Provide testing best practices, parallelization, and fast unit suites |
| Complex setup | Offer standard CI templates and developer-facing tooling |
| Resource cost | Use scalable runners, cache artifacts, and scale-to-zero strategies |
| Knowledge gaps | Maintain docs, runbooks, and training programs |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/ci-challenges-platform-solutions-slide.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=14a2fdff5f118dc209d4b6d2ca1dd2f5" alt="A presentation slide titled &#x22;Common CI Challenges and How Platforms Address Them&#x22; showing a two-column box: left lists typical CI challenges (slow tests, complex setup, resource costs, knowledge gaps) and right lists platform solutions (optimization guidance, standardized templates, shared CI infrastructure, training/documentation)." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/ci-challenges-platform-solutions-slide.jpg" />
</Frame>

## Measure CI effectiveness

Track quantitative indicators and use them to drive improvements:

| Metric | What it tells you |
| -: | - |
| Build time | How quickly developers get feedback |
| Merge success rate | Percent of successful merges on first try |
| Integration frequency | How often changes reach `main` |
| Post-merge defects | Bugs discovered after merge (quality) |

Aim for shorter build times, higher success rates, more frequent confident commits, and fewer post-merge bugs.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/measuring-ci-effectiveness-key-indicators.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=c9824e8c8e90d8b849c943b5c0e3cd48" alt="A presentation slide titled &#x22;Measuring CI Effectiveness – Key Indicators&#x22; showing four metric cards: Build Time, Success Rate, Frequency, and Quality, each with a short definition (e.g., how quickly developers get feedback; percentage of builds that pass)." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/measuring-ci-effectiveness-key-indicators.jpg" />
</Frame>

## Key takeaways

* Embed CI into the platform philosophy so testing and validation are automated and immediate.
* Protect `main` and keep it deployable by gating merges with CI and reviews.
* Use a feature-branch workflow that’s safe, fast, and structured.
* Enable cross-functional collaboration and collect measurable CI metrics to drive continuous improvement.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-key-takeaways.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=238fedf37d88b23ff99619c095bdbf27" alt="A presentation slide titled &#x22;Key Takeaways – Continuous Integration&#x22; with four colored, rounded panels numbered 05–08. The panels are labeled Feature Branch Workflow, Platform Enablement, Team Collaboration, and Measurable Quality with brief supporting notes." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-key-takeaways.jpg" />
</Frame>

Track integration health and apply data-driven optimizations so CI becomes a predictable, low-risk process rather than a risky integration event. As a core component of platform engineering, CI is essential to modern software delivery.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1Eshd7pplxDXcxR5/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-key-takeaways-2.jpg?fit=max&auto=format&n=1Eshd7pplxDXcxR5&q=85&s=5464ecfbcab16e1dc37be94702409963" alt="A presentation slide titled &#x22;Key Takeaways – Continuous Integration&#x22; showing a &#x22;Platform Value&#x22; box with three bullet points about CI improving development, enabling a confident daily workflow, and forming the foundation of modern software delivery. There's also a faint gear/box icon and a © Copyright KodeKloud notice." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-3-Continuous-Delivery-Platform-Engineering/Continuous-Integration-Basics/continuous-integration-key-takeaways-2.jpg" />
</Frame>

Thanks for reading. Future lessons will cover Continuous Delivery (CD) and deployment strategies.

## Links and references

* [Jenkins](https://www.jenkins.io/)
* [Prometheus](https://prometheus.io/)
* [Grafana](https://grafana.com/)
* [Kubernetes Documentation](https://kubernetes.io/docs/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/certified-cloud-native-platform-engineering-associate-cnpa/module/b1af4eef-35d2-47b1-8964-1e80b1f1a739/lesson/49a398ce-2f35-4cbe-8ea5-06f70893f44d" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.