12/71
Sign inSign up free

805. DRY GitLab CI Jobs With extends

easy 10 XP ~8 minHands-on lab

The three test jobs in /home/student/repos/webapp/.gitlab-ci.yml repeat the same image, setup and settings, and they've already drifted: typecheck still runs an old Python.

Task

  • Create a hidden job .python holding the shared settings: stage: test, image: python:3.12-slim, the before_script, the PIP_CACHE_DIR variable and the docker tag.
  • Make unit, integration and typecheck extend .python. They must not repeat stage, image, before_script or tags themselves.
  • integration additionally sets the variable DB_URL: sqlite:///test.db. It must still get PIP_CACHE_DIR too.

Each job keeps its own script.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.