- Before you begin
- Create a new group
- Create a new compliance pipeline project
- Configure compliance framework
- Create a new project and apply the compliance framework
- Combine pipeline configurations
Tutorial: Create a compliance pipeline
You can use compliance pipelines to ensure specific compliance-related jobs are run on pipelines for all projects in a group. Compliance pipelines are applied to projects through compliance frameworks.
In this tutorial, you:
- Create a new group.
- Create a new project for the compliance pipeline configuration.
- Configure a compliance framework to apply to other projects.
- Create a new project and apply the compliance framework to it.
- Combine compliance pipeline configuration and regular pipeline configuration.
Before you begin
- You need permission to create new top-level groups.
Create a new group
Compliance frameworks are configured in top-level groups. In this tutorial, you create a top-level group that:
- Contains two projects:
- The compliance pipeline project to store the compliance pipeline configuration.
- Another project that must run a job in its pipeline that is defined by the compliance pipeline configuration.
- Has the compliance framework to apply to projects.
To create the new group:
- On the left sidebar, at the top, select Create new () and New group.
- Select Create group.
- In the Group name field, enter
Tutorial group
. - Select Create group.
Create a new compliance pipeline project
Now you’re ready to create a compliance pipeline project. This project contains the compliance pipeline configuration to apply to all projects with the compliance framework applied.
To create the compliance pipeline project:
- On the left sidebar, select Search or go to and find the
Tutorial group
group. - Select New project.
- Select Create blank project.
- In the Project name field, enter
Tutorial compliance project
. - Select Create project.
To add compliance pipeline configuration to Tutorial compliance project
:
- On the left sidebar, select Search or go to and find the
Tutorial compliance project
project. - Select Build > Pipeline editor.
- Select Configure pipeline.
-
In the pipeline editor, replace the default configuration with:
--- compliance-job: script: - echo "Running compliance job required for every project in this group..."
- Select Commit changes.
Configure compliance framework
The compliance framework is configured in the new group.
To configure the compliance framework:
- On the left sidebar, select Search or go to and find the
Tutorial group
group. - Select Secure > Compliance center.
- On the page, select the Frameworks tab.
- Select New framework.
- In the Name field, enter
Tutorial compliance framework
. - In the Description field, enter
Compliance framework for tutorial
. - In the Compliance pipeline configuration (optional) field, enter
.gitlab-ci.yml@tutorial-group/tutorial-compliance-project
. - In the Background color field, select a color of your choice.
- Select Add framework.
For convenience, make the new compliance framework the default for all new projects in the group:
- On the left sidebar, select Search or go to and find the
Tutorial group
group. - Select Secure > Compliance center.
- On the page, select the Frameworks tab.
- Select
Tutorial compliance framework
then, select Edit framework. - Select Set as default.
- Select Save changes.
Create a new project and apply the compliance framework
Your compliance framework is ready, so you can now create projects in the group and they automatically run the compliance pipeline configuration in their pipelines.
To create a new project for running the compliance pipeline configuration:
- On the left sidebar, select Search or go to and find the
Tutorial group
group. - Select Create new () and New project/repository.
- Select Create blank project.
- In the Project name field, enter
Tutorial project
. - Select Create project.
On the project page, notice the Tutorial compliance framework
label appears because that was set as the default
compliance framework for the group.
Without any other pipeline configuration, Tutorial project
can run the jobs defined in the compliance
pipeline configuration in Tutorial compliance project
.
To run the compliance pipeline configuration in Tutorial project
:
- On the left sidebar, select Search or go to and find the
Tutorial project
project. - Select Build > Pipelines.
- Select Run pipeline.
- On the Run pipeline page, select Run pipeline.
Notice the pipeline runs a job called compliance-job
in a test stage. Nice work, you’ve run your first compliance
job!
Combine pipeline configurations
If you want projects to run their own jobs as well as the compliance pipeline jobs, you must combine the compliance pipeline configuration and the regular pipeline configuration of the project.
To combine the pipeline configurations, you must define the regular pipeline configuration and then update the compliance pipeline configuration to refer to it.
To create the regular pipeline configuration:
- On the left sidebar, select Search or go to and find the
Tutorial project
project. - Select Build > Pipeline editor.
- Select Configure pipeline.
-
In the pipeline editor, replace the default configuration with:
--- project-job: script: - echo "Running project job..."
- Select Commit changes.
To combine the new project pipeline configuration with the compliance pipeline configuration:
- On the left sidebar, select Search or go to and find the
Tutorial compliance project
project. - Select Build > Pipeline editor.
-
In the existing configuration, add:
include: - project: 'tutorial-group/tutorial-project' file: '.gitlab-ci.yml'
- Select Commit changes.
To confirm the regular pipeline configuration is combined with the compliance pipeline configuration:
- On the left sidebar, select Search or go to and find the
Tutorial project
project. - Select Build > Pipelines.
- Select Run pipeline.
- On the Run pipeline page, select Run pipeline.
Notice the pipeline runs two jobs in a test stage:
-
compliance-job
. -
project-job
.
Congratulations, you’ve created and configured a compliance pipeline!