Stages
Usage
include:
- "https://gitlab.com/cappysan/ci-templates/-/raw/master/gitlab-ci/stages.yml"
Default stages
Continuous Integration (CI) pipelines typically involve a series of stages and steps to automate the development, testing, and deployment processes.
GitLab CI defaults to 5 stages if nothing is specified.
Meanwhile, this project’s default stages are the GitLab stages expanded with a pre- and post- stage. In addition, new stages such as lint and coverage exist.
.pre: Predefined GitLab default stage.
pre-lint
lint: This stage involves using tools to analyze the codebase for potential issues, such as code style violations.
post-lint
pre-coverage
coverage: Calculate code coverage metrics to ensure that a sufficient percentage of the codebase is covered by automated tests.
post-coverage
pre-build
build: Predefined GitLab default stage.
post-build
pre-test
test: Predefined GitLab default stage.
post-test
pre-release
release: Automatically generate release notes or changelogs based on code changes and commits in version control.
post-release
pre-deploy
deploy: Predefined GitLab default stage.
post-deploy
pre-trigger
trigger
post-trigger
pre-cleanup
cleanup
post-cleanup
.post: Predefined GitLab default stage.
Rationale
The idea behind is that main stages, those without a prefix, are to depend on other main stages while jobs with prefixes should only depend on the main stage without said prefix.
For example:
build-job:
stage: build
(...)
build-job-cleanup:
stage: post-build
needs:
- build-job
(...)
deploy-job-preparation:
stage: pre-deploy
(...)
deploy-job:
stage: deploy
needs:
- build-job
- deploy-job-preparation
(...)
deploy-job-cleanup:
stage: post-deploy
needs:
- deploy-job
(...)
