1. Reusing #
No more copy-paste.
The levels #
# templates/python-test/template.yml (CI/CD component)
spec:
inputs:
python_version:
default: "3.12"
stage:
default: test
---
python-test:
stage: $[[ inputs.stage ]]
image: python:$[[ inputs.python_version ]]-slim
script: [pip install -r requirements-dev.txt, pytest]
# .gitlab-ci.yml of a consuming project
include:
- component: $CI_SERVER_FQDN/mon-groupe/ci-components/python-test@1.2.0
inputs: { python_version: "3.13" }
- template: Jobs/SAST.gitlab-ci.yml
- template: Jobs/Secret-Detection.gitlab-ci.ymlextendsinherits from a hidden job (.python);!referencereuses a precise part (ascriptlist).- CI/CD components are versioned (semantic tags), parameterized by
spec:inputsand published to the CI/CD catalog; pin a precise version. - Parent-child pipelines (
trigger: include) split a monorepo; multi-project pipelines (trigger: project) chain several repositories.
2. Secrets and identities #
No long-lived key in CI.
OIDC #
deploy:
id_tokens:
CLOUD_TOKEN:
aud: https://iam.example-cloud.com
script:
- ./exchange-token.sh "$CLOUD_TOKEN" # the provider checks project, branch and environmentid_tokens generates an OIDC token signed by GitLab for this job; AWS, Azure, Google Cloud or Vault exchange it for temporary rights, limited to a project, branch or environment. The old CI_JOB_JWT is removed.
Watch out : A masked variable is not a vault: a job can write it to a file or encode it. Restrict sensitive variables to protected branches.
3. Built-in security and merge requests #
Controls in the right place.
Scans #
| Template | Detects | Plan |
|---|---|---|
| Jobs/SAST | code vulnerabilities | Free |
| Jobs/Secret-Detection | committed secrets | Free |
| Jobs/Dependency-Scanning | vulnerable dependencies | Ultimate |
| Jobs/Container-Scanning | image vulnerabilities | Free (rapport) / Ultimate (tableaux) |
- Merge request pipelines test the branch; merged results pipelines test the result of merging with the target.
- Merge trains (Premium) queue merges, testing each on top of the previous ones: the main branch stays green.
Commands to know #
Commands to know
glab ci lint: validate includes and componentsglab variable set NOM --masked --protected: create a protected variableglab mr create --fill: open a merge request
Sources #
Checked in November 2026: CI/CD platforms change every month, check versions and plans in the vendor's documentation.
