CI/CD Pipeline
A pipeline is the top-level component of the continuous integration and delivery (CI/CD) process.
A pipeline consists of the following elements:
Jobs that define what needs to be done,
Stages that determine when a job should be executed (e.g., the build
stage typically follows the test
stage).
Stage jobs are executed by agents. Different jobs within a stage run in parallel, with each job executing independently. The number of parallel jobs is limited by the available agents.
Pipeline Configuration
The pipeline and its components (jobs and stages) are defined in a dedicated configuration file, gitflic-ci.yaml
, unique to each project.
- A job is the basic configuration component, defined by its name (e.g.,
job-for-test
). - Stages are defined using the
stages
keyword.
Example configuration file
image: ubuntu:latest
variables:
TEST_1_SUCCESS: "true"
TEST_2_SUCCESS: "true"
before_script:
- echo "Pre-script (executed in every job)"
stages:
- test
- build
- deploy
build:
stage: build
script:
- echo "Building the project"
- echo "Built project" > build.txt
artifacts:
paths: build.txt
test1:
stage: test
script:
- echo "First test suite"
- echo $TEST_1_SUCCESS
test2:
stage: test
script:
- echo "Second test suite"
- echo $TEST_2_SUCCESS
deploy:
stage: deploy
script:
- echo $(cat build.txt)
- echo "Deploying the project"
needs:
- build
rules:
- if: $TEST_1_SUCCESS == "true" && $TEST_2_SUCCESS == "true"
after_script:
- echo "Post-script (executed in every job)"
For a full list of configuration options, refer to the CI/CD Configuration Reference.
Remote configuration files are also supported. Learn more about remote configuration in Project CI/CD Settings.
Starting a Pipeline
To start a pipeline, click the Create Pipeline button on the pipeline overview page. In the popup:
1. Specify the branch or tag for the pipeline.
2. Review or override prefilled variables.
3. Optionally, create variables specific to this pipeline.
After confirmation, the new pipeline will appear in the pipeline list. Jobs will be picked up by agents when available.
Pipeline Contents
Current and past pipeline runs can be found under CI/CD > Pipelines in your project.
Click a pipeline number to open its details page (URL format: project-name/ci-cd/pipeline/*/
, where *
is the pipeline ID). The page displays:
- Job execution status
- Pipeline controls (restart/delete)
- Execution logs
- Project artifacts
To delete a pipeline, click Delete in the top-right corner.
Jobs Tab
Lists all jobs across pipelines with their statuses, stage, name, and execution time. Individual jobs can be restarted via the ellipsis menu.
Artifacts Tab
Contains all artifacts generated by the pipeline. To download an artifact, click the download button next to the file. Artifacts are automatically deleted after a set period but can be manually removed earlier.
Merge Request Pipeline
A Merge Request Pipeline is a special pipeline type triggered by merge requests. It validates new code before merging into another branch.
To enable:
1. Go to Project Settings > CI/CD Settings.
2. Toggle "Enable Merge Request Pipeline".
For existing merge requests, a Create Merge Request Pipeline button will appear. New merge requests will auto-generate these pipelines.
Key features:
- Runs on the source branch, ignoring the target branch. For merged-code validation, use the Merge Result Pipeline.
- Supports predefined CI_MERGE_REQUEST
variables.
Merge Result Pipeline
Available in Enterprise edition
A Merge Result Pipeline automatically runs when a merge request is created (e.g., from hotfix
to main
). It validates the merged code to ensure:
- No conflicts
- Correct integration with the target branch
- Deployment readiness
To enable:
1. Navigate to Project Settings > CI/CD Settings.
2. Toggle "Enable Merge Result Pipeline".
Note
This pipeline cannot run if the merge request has conflicts. Resolve conflicts to enable the Create Merge Result Pipeline button.
Learn more about merge requests here.
Important: Changes to the target branch won’t auto-trigger a new pipeline. For continuous validation, use Merge Trains.
Pipeline Type Comparison
Feature | Standard Pipeline | Merge Result Pipeline | Merge Request Pipeline |
---|---|---|---|
Trigger | Branch changes | MR creation/source branch updates | MR creation/source updates |
Execution Context | Single-branch validation | Post-merge simulation | Pre-merge source validation |
Purpose | Isolated change verification | Integration safety check | Pre-merge code quality |
Automatic translation!
This page has been automatically translated. The text may contain inaccuracies