What you will learn in this TP
- Write a test → build workflow
- Add a security scan
- See a test fail
The pipeline #
What you will learn in this section
- Write a test → build workflow
- Add a security scan
- See a test fail
Context. A team ships by hand, with frequent mistakes and painful rollbacks. A CI/CD pipeline automates tests, build and publishing on every change: you build a complete one and see how it blocks a faulty change.
Prerequisites: A GitHub (or GitLab) account, Docker · Estimated time: 45 min
From application to registry.1. A testable application
Why? A unit test is the pipeline's safety net: without it, automating deployment only automates mistakes.
Create a small API and a unit test.2. Dockerfile and workflow
Why? The "build needs test" dependency guarantees an image is never published if tests fail.
Write the workflow: tests then image build.3. Add a security scan
Why? Integrating security in the pipeline (shift-left) finds a vulnerability at build time rather than in production.
Fail the pipeline on critical vulnerabilities.4. Observe and fix
Why? Deliberately breaking a test proves the pipeline does its job: it blocks the change and protects the main branch.
Deliberately break the test, see it fail then fix it.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
DevOps best practices: culture, CI/CD, infrastructure as code and measurement
DevOps best practices: culture and collaboration, continuous integration and delivery, trunk-base...
End-to-end CI/CD (5/5): GitHub Actions, GitLab CI, Jenkins and Argo CD in practice
Compare and use CI/CD tools: GitHub Actions, GitLab CI, Jenkins, Argo CD and Flux; a complete pip...
End-to-end CI/CD (1/5): principles and anatomy of a pipeline
Understand end-to-end CI/CD: continuous integration, continuous delivery and continuous deploymen...
End-to-end CI/CD (2/5): continuous integration, testing and quality
Succeed with continuous integration: the test pyramid, unit, integration, contract and end-to-end...
End-to-end CI/CD (4/5): deployment strategies and rollback
Deploy without downtime and without risk: recreate, rolling update, blue/green, canary, feature f...
End-to-end CI/CD (3/5): artifacts, registries and environments
Deliver continuously: immutable, versioned artifacts, image and package registries, promoting the...
DevSecOps: securing the software supply chain end to end
Integrate security into the DevOps pipeline: shift-left, threat modeling, secret detection, SAST,...
k6 in continuous integration and on Kubernetes (k6-operator)
Automate performance tests: k6 in GitHub Actions and GitLab CI with blocking thresholds, distribu...
Terraform in CI/CD: pipelines, plan review, OIDC and GitOps
Automate Terraform: plan pipeline on merge requests and apply after approval, posting the plan as...