Conventions
The pipeline
| Topic | Convention | Example |
|---|---|---|
| Job names | <part>:<step> | api:test, web:build |
| Deployment job names | deploy-<environment> | deploy-prod |
| A part's jobs | in its folder's .gitlab-ci.yml, included by the root | web/.gitlab-ci.yml |
| Lint and tests | rules: changes on the part's folder | web/**/* |
| Build | on every push to develop and main | — |
| Images | $CI_REGISTRY_IMAGE/<part>:$CI_COMMIT_SHORT_SHA | …/api:5a86221 |
| CI image versions | always a precise version | docker:27.5.1-dind, never docker:latest |
| Reports | JUnit and Cobertura, when: always | — |
Docker
- Two Dockerfiles per application:
Dockerfile.dev,Dockerfile.prod. - In prod: multi-stage, non-root user,
HEALTHCHECK. - Comments explain why, in French.
- No secret value in a Dockerfile or a Compose file:
${VARIABLE}only.
Ansible
- One role per topic, with a tag of the same name.
- Each task has a
namesaying what it does, in English. - Every task must be idempotent: re-running the playbook must not break or duplicate anything.
- Secrets in
vault.yml, tasks handling them withno_log: true.
Traefik
- One route file per application and per server:
dynamic/<env>/<application>.yml. - Routers and services prefixed with the environment:
prod-web,dev-api.
The docs
- Each part is written by its owner.
- An infrastructure change is documented in the same merge request, in French and in English.
- File excerpts are included (
<<<or@include), never copied.
Git
Messages ci: …, chore(ansible): …, feat(infra): …, fix(traefik): …. See The Git repository.