RousselTMLEARNING

TP · GitLab CI/CD: from discovery to expertise

Lab: Local runner, registry and environments

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
Mode :

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. 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 the local-docker tag and copy its token, then run and register gitlab/gitlab-runner:v19.6.1.
  2. 2. Publish and deploy

    Why? One image per commit, deployed by the same definition in each environment: the "build once, deploy many" principle.

    Add the deploy stage, the build-image job, the hidden .deploy job and the recette (automatic) and production (manual) jobs to .gitlab-ci.yml, then push.
  3. 3. Check environments

    Why? Deployment history tells at any time which version runs where.

    Open Operate › Environments, trigger production, then check both URLs.
  4. 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

  • ⏱ Estimated time : ≈ 50 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

4.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

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...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!