Skip to main content

How do I use the approvals section in a pipeline as code?

To use the approvals section in a GitLab pipeline as code, you can define a set of approval rules that determine who needs to approve a pipeline before it can proceed to the next stage. The approvals section allows you to specify the number of required approvals and the list of approvers.

Here's an example of how you can use the approvals section:

- name: Approve pipeline
when: manual
allow_failure: false
- username: john
- username: jane

In the above example:

approvals is the keyword that indicates the start of the approvals section.

rules specifies the list of approval rules.

name is the name of the approval rule.

when specifies when the approval should be requested. In this case, manual indicates that the approval is required manually.

allow_failure defines whether the pipeline can proceed without the approval. Set it to false to require approval before proceeding.

approvals lists the usernames of the individuals who need to approve the pipeline. Replace john and jane with the actual usernames.

By using the approvals section, you can enforce an approval process for critical stages in your pipeline. This ensures that designated approvers review and authorize the pipeline before it progresses further.

If you have further questions or need assistance with implementing the approvals section or optimizing your pipelines, feel free to reach out to Cloud-Runner. We specialize in helping developers maximize the efficiency and performance of their CI/CD workflows. Visit to learn more about our services and how we can support your pipeline automation needs.