Replace only/except With rules in GitLab CI
/home/student/repos/billing-service/.gitlab-ci.yml still uses only: and except:. The team switched to merge request pipelines, and the old conditions now run the wrong jobs: nightly never runs, and the default branch is about to be renamed, which would silently stop deploy.
Rewrite the conditions with rules: only (no only: or except: left anywhere). Keep every job's stage and script.
| Job | Must run in |
|---|---|
test | every pipeline except scheduled ones |
docs | merge request pipelines (merge_request_event) that change a file under docs/ (at any depth) |
deploy | pushes to the default branch only: not merge requests, tags or schedules. Don't hard-code the branch name. |
nightly | scheduled pipelines only, and it is allowed to fail |
The grader simulates pushes to the default branch and to a feature branch, merge requests with and without docs changes, a scheduled pipeline, a tag, and a project whose default branch is called trunk.
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
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.