What you will learn in this TP
- Install and register a project runner
- Publish an image with CI_JOB_TOKEN
- Deploy to environments with extends
- Roll back to a previous version
All steps and instructions are shown. Recommended for this lab: semi-guided
Introduction #
Context. The team wants to deploy the shop without using shared minutes and keep a history of what runs in staging and production.
Prerequisites: a free GitLab.com account, Git and Python 3, Docker on your machine, the Lab 1 project · Estimated time: 50 min
A local runner, one image per commit in the registry, two tracked environments and a rollback performed.Setup #
Guided steps, with their solution.
1. Create the runner
Why? A project runner runs on your machine: your jobs no longer depend on shared runners.
In Settings › CI/CD › Runners › New project runner, create a runner with thelocal-dockertag and copy its token, then run and registergitlab/gitlab-runner:v19.6.1.2. Publish and deploy
Why? One image per commit, deployed by the same definition in each environment: the "build once, deploy many" principle.
Add thedeploystage, thebuild-imagejob, the hidden.deployjob and therecette(automatic) andproduction(manual) jobs to.gitlab-ci.yml, then push.3. Check environments
Why? Deployment history tells at any time which version runs where.
Open Operate › Environments, triggerproduction, then check both URLs.4. Roll back
Why? A one-click rollback, without rebuilding, is the best safety net of a deployment.
Push a new commit, deploy it to production, then redeploy the previous deployment from the environment page. Finally, stop the containers.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●●○○ (3/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 runners: types, executors, installation and security
Running GitLab jobs: instance, group and project runners, docker, kubernetes and docker-autoscale...
Building and delivering with GitLab: registry, environments and deployments
Delivering with GitLab CI/CD: building and publishing images to the project registry, package reg...
End-to-end CI/CD (3/5): artifacts, registries and environments
Deliver continuously: immutable, versioned artifacts, image and package registries, promoting the...
GitLab CI/CD: concepts and architecture
Discover GitLab CI/CD: the DevSecOps platform, the .gitlab-ci.yml file, pipelines, stages and job...
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...
Delivering with GitHub Actions: GHCR, environments, OIDC and attestations
Building and deploying with GitHub Actions: publishing an image to GitHub Container Registry with...
GitLab CI/CD best practices and troubleshooting
Running GitLab CI/CD day to day: speeding up pipelines, controlling compute minutes, organizing f...
Container registry: choosing and securing your image registry (Docker Hub, Harbor, GHCR, ECR)
Understand container registries: Docker Hub, GitHub Container Registry, cloud registries (ECR, AC...
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...