Prompt

How do I add approval workflows to GitLab CI/CD with audit logs?

Technology / CI/CD & DevOps1 observationLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

You can add approval workflows to GitLab CI/CD by combining:

  1. Protected branches/tags
  2. Merge request approvals
  3. Manual jobs in CI/CD
  4. Audit events / audit logs
  5. Optionally, compliance pipelines and external approvals

Here’s the practical way to do it.


1) Use merge request approvals for code changes

This is the most common approval gate before CI/CD runs deploy or release steps.

Setup

In your GitLab project:

  • Go to Settings → Merge requests
  • Configure:
    • Approval rules
    • Required number of approvals
    • Optional approvers/groups
    • Code owner approvals

Use CODEOWNERS

Add a CODEOWNERS file so certain files require approval from specific teams.

Example:

/docs/ @docs-team
/infra/ @platform-team
*.tf @devops-team

Then enable Code owner approval in project settings.

Benefits

  • Enforces peer review
  • Tracks who approved what
  • Works well with auditability through GitLab events

2) Add manual approval gates in .gitlab-ci.yml

If you want approval before a deployment, use a manual job.

Example:

stages:
  - test
  - build
  - approve
  - deploy

test:
  stage: test
  script:
    - echo "Running tests"

build:
  stage: build
  script:
    - echo "Building app"

approve_deploy:
  stage: approve
  when: manual
  allow_failure: false
  script:
    - echo "Deployment approved"

deploy_prod:
  stage: deploy
  script:
    - echo "Deploying to production"
  needs: ["approve_deploy"]
  environment:
    name: production

How it works

  • Pipeline pauses at approve_deploy
  • A permitted user clicks Play
  • Only then does deploy_prod run

Notes

  • Manual jobs are useful, but they are not the same as a formal approval system unless you restrict who can trigger them via project permissions.
  • For stronger control, combine this with protected environments.

3) Protect environments for deployment approvals

GitLab lets you restrict who can deploy to environments like production.

Setup

Go to:

  • Settings → CI/CD → Protected environments

Add production and allow only specific users or roles to deploy.

In .gitlab-ci.yml

deploy_prod:
  stage: deploy
  script:
    - ./deploy.sh
  environment:
    name: production

Result

Only authorized users can trigger or approve deploys to production.


4) Use protected branches/tags to control release flow

Protect your main or release branches so only approved merges happen.

Setup

Go to:

  • Settings → Repository → Protected branches

Protect:

  • main
  • release/*

You can require:

  • Maintainers only to push
  • Merge requests only
  • No direct pushes

This ensures approvals happen through the MR process, not direct commits.


5) Add audit logs for approval actions

GitLab provides auditability through Audit Events.

Where to find them

Depending on your GitLab edition and setup:

  • Group → Audit Events
  • Admin Area → Audit Events
  • Sometimes project-level event history is available too

What gets logged

Typical audit events can include:

  • User added/removed from groups
  • Changes to protected branches/environments
  • Changes to approval rules
  • Role changes
  • Some security/compliance actions

CI/CD approval logging

For manual jobs and deployment approvals:

  • GitLab records job execution and user who triggered the job
  • Deployment history shows who deployed what and when
  • If using protected environments, authorization is tied to the user account

Best practice

To make approval actions easier to audit:

  • Use protected environments
  • Require MRs for production changes
  • Use approval rules and CODEOWNERS
  • Keep deploy jobs manual
  • Centralize logs to your SIEM if needed

6) Optional: use an approval job with a separate approver group

If you want a visible “approval” step in the pipeline:

approve_release:
  stage: approve
  when: manual
  allow_failure: false
  script:
    - echo "Approved by release manager"

deploy_release:
  stage: deploy
  script:
    - ./deploy.sh
  needs: ["approve_release"]

Then combine with:

  • Protected environment production
  • Allowed deployers group
  • Approvals in the MR before pipeline runs

7) Make approvals more formal with policy-as-code

If you need stricter governance, consider:

  • Code Owners
  • Compliance pipelines
  • Security approvals
  • External policy engines like:
    • OPA/Gatekeeper
    • Custom validation jobs
    • ChatOps approval workflows

A common pattern is:

  1. Merge request needs 2 approvals
  2. Pipeline runs tests
  3. Release job is manual
  4. Only release managers can approve deploy to production
  5. Audit trail records approver, timestamp, and environment

Example end-to-end workflow

1. Developer opens MR

  • Branch change is reviewed
  • Required approvers sign off

2. Pipeline runs automatically

  • Tests, lint, build, security scans

3. Deploy job is manual

  • deploy_prod waits for approval

4. Protected environment enforces access

  • Only deployment approvers can trigger it

5. Audit trail captured

  • MR approvals
  • Manual job trigger
  • Deployment event
  • All timestamps and users visible in GitLab logs

Recommended configuration for production

If your goal is “strong approval workflow with auditability,” use all three:

  • MR approvals + CODEOWNERS
  • Protected branch
  • Protected production environment with manual deploy job

That gives you:

  • Review before merge
  • Approval before deploy
  • Audit record of who approved and deployed

If you want, I can help with either of these next:

  1. A sample .gitlab-ci.yml with approval gates and production deployment
  2. A step-by-step GitLab UI setup guide
  3. A compliance/audit logging design for regulated environments

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.