What you will learn in this TP
- Create a project and its pipeline
- Use cache, artifacts and JUnit reports
- Avoid duplicate pipelines with workflow:rules
- Read a pipeline and a failed job
All steps and instructions are shown. Recommended for this lab: guided
Introduction #
Context. Your team ships the shop by copying files by hand. You set up continuous integration: every push must be checked automatically.
Prerequisites: a free GitLab.com account, Git and Python 3 · Estimated time: 40 min
A green lint → test → build pipeline, with a test report visible in GitLab and a downloadable artifact.Setup #
Guided steps, with their solution.
1. Create the project
Why? A project testable locally guarantees CI will check the same thing as you.
Create theboutiqueservice (application, tests, Dockerfile) and run the tests locally.2. Push to GitLab
Why? The remote repository will trigger pipelines.
Create an emptyboutiqueproject on GitLab.com (no README) and push yourmainbranch.3. Write the pipeline
Why? Three simple stages already give fast, reliable feedback.
Create.gitlab-ci.ymlwithlint,test(pip cache, JUnit report) andbuild(archive as artifact, onmainonly) stages, then push.4. Cause and read a failure
Why? Knowing how to read a failure matters as much as having a green pipeline.
On a branch, change the default rate to 0.21, open a merge request, look at the pipeline Tests tab, then revert the change.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
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
GitLab CI/CD: concepts and architecture
Discover GitLab CI/CD: the DevSecOps platform, the .gitlab-ci.yml file, pipelines, stages and job...
Writing a .gitlab-ci.yml: jobs, rules, cache and artifacts
Mastering .gitlab-ci.yml syntax: stages, jobs and images, rules and workflow, needs (DAG), cache ...
GitLab runners: types, executors, installation and security
Running GitLab jobs: instance, group and project runners, docker, kubernetes and docker-autoscale...
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...
Building and delivering with GitLab: registry, environments and deployments
Delivering with GitLab CI/CD: building and publishing images to the project registry, package reg...
Reusing and securing GitLab pipelines
Industrializing GitLab CI/CD: extends, anchors and !reference, include, CI/CD components and cata...
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...
GitLab CI/CD best practices and troubleshooting
Running GitLab CI/CD day to day: speeding up pipelines, controlling compute minutes, organizing f...
GitHub Actions: concepts and how it works
Discover GitHub Actions: events, workflows, jobs, steps and actions, the Marketplace, hosted runn...