DRY GitLab CI Jobs With extends
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.
.python holding the shared settings: stage: test, image: python:3.12-slim, the before_script, the PIP_CACHE_DIR variable and the docker tag.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.
Part of CI/CD Pipelines in Practice. Next step: GitLab CI Cache vs Artifacts
Teaching or writing about this? Embed this lab on your page
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.