CI, CD, DevSecOps, GitOps and SRE Explained

DevOps and Cloud Engineering: Complete Course from Beginner to Advanced · DevOps Fundamentals · 8 min read · Updated

From commit to users

  1. Every change starts in Git. With GitOps, Git also describes the live system.
  2. CI builds the change and runs the tests and security scans on every push.
  3. Continuous delivery prepares the release. Continuous deployment sends it live by itself.
  4. SRE practices watch the service against targets and feed lessons back to the team.

DevOps comes with a lot of short names. They are easy to mix up, and job descriptions use them freely. This lesson gives each one a plain meaning and shows how they connect, so that when you read a job post or an article you know what is being asked. We will use one small running example: a team that keeps a website in Git and wants every change to reach the live site safely.

Why do we need it?

Releasing software by hand is slow and easy to get wrong, and finding a bug late or a security hole at the end is expensive. CI, CD, DevSecOps and GitOps give teams automatic checks and a repeatable path to production, and SRE gives them a way to decide how reliable the service must be.

A real-life example

Picture an airport. Before every flight, a checklist runs: fuel, engines, doors, weather. The checklist is the same every time, and a flight does not leave until all items pass. A pipeline is that checklist for software. DevSecOps adds security screening early in the process, not at the gate. SRE is the control tower that watches all flights and sets safety targets.

Continuous Integration (CI)

Integration means putting different people’s work together. In the old way, developers worked alone for weeks and tried to join their code at the end, and the join was painful. Continuous Integration means that everyone adds their work to the shared project often, at least daily, and each time a robot builds the project and runs the tests. If something breaks, the team knows within minutes, while the change is still small and fresh in the author’s mind. The robot is a CI server or a CI service such as GitHub Actions or Jenkins, which you will meet later in this course.

Continuous Delivery and Continuous Deployment

The two CDs are a common source of confusion, because they share the letters CD. They differ in one step.

  • Continuous Delivery means every change that passes the tests is automatically prepared so that it could be released at any moment. A person still decides when to press the button.
  • Continuous Deployment goes one step further: every change that passes all checks goes to the live system automatically, with no button.

Which is better depends on the product and the rules. A small website may use continuous deployment. A bank app may use continuous delivery with a required approval. Both rely on the same foundation: good automatic tests and a deployment that is safe to repeat. When you see CI/CD written together, it usually means the whole path from commit to release.

DevSecOps

Security used to be a checkpoint at the end: a separate team reviewed the finished product, often right before launch, and found problems that were expensive to fix. DevSecOps means building security into every step instead. Typical examples are scanning code for known weak spots, checking that libraries you depend on have no known problems, scanning container images, and keeping passwords and keys out of the code. The idea is called shift left, which means moving checks earlier in the loop, towards the left side of the diagram, where mistakes are cheaper to fix. You will build these checks in the security module.

GitOps

GitOps is a way to run systems where Git is the source of truth. You describe what you want the live system to look like in files in a Git repository, for example which version of the app should run and how many copies. A tool watches the repository and makes the real system match it. To change production you do not log in to a server. You open a pull request, someone reviews it, you merge it, and the tool applies it. This gives you review, a history of every change and an easy way back: revert the commit. Tools that do this for Kubernetes include Argo CD and Flux, which have their own lessons later.

Site Reliability Engineering (SRE)

SRE began at Google as a way of running big systems by treating operations as a software problem. An SRE team writes code to run and fix services, and sets clear targets for how reliable a service must be. Two ideas are worth knowing now. First, you do not aim for perfect reliability, which is impossible and very costly. You agree a target, for example the site should answer correctly 99.9 percent of the time, and that leaves a small allowed amount of failure called an error budget. Second, if the budget is spent, the team slows down new features and focuses on stability. The target numbers in this course are examples only: your own service and your own users decide what is right.

How they fit together

  1. A developer pushes a change to Git (GitOps starts here).
  2. CI builds and tests it, including security scans (CI and DevSecOps).
  3. The change is delivered or deployed to the live system (CD).
  4. The system is watched against agreed targets, and the team learns from incidents (SRE).

None of these needs a particular tool. They are ideas, and you can start small. A single script and a tiny test suite is already a beginning of CI.

Architecture diagram

Here is the idea as a simple picture. You can use the same diagram in your own notes.

flowchart LR
  G[Git push] --> CI[CI: build and test]
  CI --> S[Security scans]
  S --> CD[CD: release]
  CD --> P[Production]
  P --> M[Monitoring and SRE targets]
  M -->|lessons| G

How to check it worked

  • You can explain the difference between delivery and deployment.
  • You can say what shift left means.
  • You can explain in one sentence why GitOps uses pull requests for production changes.

How companies use it

Most product teams use a CI service so every pull request is built and tested. Many use continuous delivery with an approval step for production, and some use continuous deployment for low-risk systems. Teams that run Kubernetes often use GitOps tools to keep the cluster in line with a Git repository. Larger companies have SRE teams who define service level objectives and run on-call rotations.

Common errors and how to fix them

  • Pipeline is red but nobody fixes it. A broken pipeline that is ignored is worse than none. Make fixing it the first priority and keep the checks fast.
  • Tests that sometimes pass and sometimes fail. Flaky tests teach people to ignore failures. Find the cause, such as timing or shared data, or remove the test until it is reliable.
  • Security scans that block everything. Start by reporting, then block only on serious findings, and fix the noise as you go.
  • Secrets in the repository. Move them to the CI secret store and rotate any key that was ever committed.

Best practices

  • Run the pipeline on every pull request.
  • Keep the pipeline fast so people do not skip it.
  • Make the same artifact move through every stage, do not rebuild it for production.
  • Store secrets outside Git.
  • Pick reliability targets from user needs, and track them.

Interview questions with simple answers

  1. What is continuous integration? Adding work to the shared project often, and building and testing every change automatically.
  2. Continuous delivery vs continuous deployment? Delivery makes every passing change ready to release, and a person chooses when. Deployment releases it automatically.
  3. What is DevSecOps? Building security checks into every step of the pipeline instead of only at the end.
  4. What is GitOps? Keeping the desired state of a system in Git, and using a tool to make the real system match it.
  5. What is an SRE? An engineer who runs services using software, with clear reliability targets and error budgets.
  6. What is an error budget? The amount of failure a service is allowed under its target. When it is used up, work shifts from features to stability.
  7. What is an SLO? A reliability target, for example that 99.9 percent of requests succeed over a month.
  8. What does shift left mean? Moving checks earlier in the process.
  9. Why do GitOps changes use pull requests? They give review, a history and an easy way back by reverting a commit.
  10. What makes a good pipeline? Fast, reliable, repeatable, with clear failures and no secrets in the code.

Practical exercises

Try each one yourself before you look at the hint. Struggling for a few minutes is how the skill sticks.

  1. Draw a pipeline for a small website: three checks and one deploy step. Hint: Linting, tests, build, deploy.
  2. Write one SLO for a service you know, in a sentence. Hint: Choose a percentage and a time window.
  3. Explain delivery vs deployment to someone with an example. Hint: A bank app and a personal blog.
  4. List three security checks that could run in a pipeline. Hint: Think of code, packages and containers.
  5. Rewrite a manual release you know as a list of automatic steps. Hint: Each manual step becomes a pipeline step.

Mini project: Pipeline on paper

Choose any project. Write the stages of its pipeline as a numbered list: what triggers it, what each stage does, what makes it fail and who is told. Add one security check and one approval point, then explain why you put them there.

Knowledge test

Answer the ten questions in the quiz at the end of this lesson. You pass with 60 percent. If an answer is wrong, read the explanation, then reread the part of the lesson it points to.

Frequently asked questions

What is the difference between continuous delivery and continuous deployment?

With delivery, a change that passes the checks is ready to release and a person chooses when. With deployment, it goes live automatically after the checks.

Is GitOps only for Kubernetes?

It is most common with Kubernetes, but the idea of keeping the desired state in Git and applying it automatically can be used for other systems too.

Is SRE the same as DevOps?

They overlap. DevOps is a broad set of practices. SRE is a specific way of running services with reliability targets, error budgets and a software approach to operations.

Practise with interview questions