Hands-on task
GitLab CI: inheritance via extends
The project app (cloned to /root/app, the web sign-in is on the GitLab tab) has a green pipeline, but .gitlab-ci.yml is copy-pasted: the lint and test jobs set the same variables and before_script.
Move what they share into a hidden template job .base (with variables and before_script), and let lint and test inherit it via extends, keeping only stage and script of their own. Push to main: the pipeline must stay green. Open .gitlab-ci.yml in the Editor tab, and look at the resulting config after extends in GitLab: Build → Pipeline editor → Full configuration.
- gitlab ci
- extends
- job templates
- inheritance
- yaml