Skip to main content

GitLab Setup

Connect your GitLab repositories to Cloudgeni to enable automated security scanning, merge request reviews, and compliance monitoring for your Infrastructure as Code.

What You'll Get

  • Automatic repository discovery from your GitLab groups - Merge request security reviews with inline comments - Webhook integration for real-time scanning - Support for GitLab.com and self-hosted instances

Prerequisites

  • GitLab account with Owner or Maintainer access to repositories - Repositories containing IaC files (Terraform, Bicep, etc.) - For self-hosted: GitLab version 13.0 or later

Quick Start

Step 1: Navigate to Integrations

  1. Log in to your Cloudgeni dashboard
  2. Go to SettingsIaC Repositories
  3. Click Connect Git Provider
  4. Select GitLab

Step 2: Authorize Cloudgeni

  1. Click Connect with GitLab
  2. You’ll be redirected to GitLab’s authorization page
  3. Review the requested permissions
  4. Click Authorize to grant access
Cloudgeni requests read access to your repositories and the ability to post merge request comments.

Step 3: Select Repositories

  1. After authorization, you’ll see your GitLab groups
  2. Expand groups to see available repositories
  3. Toggle repositories you want to monitor
  4. Click Save Selection

Self-Hosted GitLab

Configure Custom Instance

For self-hosted GitLab (GitLab CE/EE):
  1. In Cloudgeni, go to SettingsIaC Repositories
  2. Click Connect Git ProviderGitLab
  3. Click Use Self-Hosted GitLab
  4. Enter your GitLab instance URL (e.g., https://gitlab.yourcompany.com)
  5. Continue with OAuth authorization

Network Requirements

Ensure your GitLab instance can communicate with Cloudgeni:
DirectionEndpointPurpose
Outboundapi.cloudgeni.aiAPI communication
InboundYour GitLab URLWebhook callbacks

SSL/TLS Requirements

  • Self-signed certificates require additional configuration
  • Contact support for private CA setup

Permissions

Required Scopes

Cloudgeni requests these GitLab OAuth scopes:
ScopePurpose
read_apiAccess repository metadata
read_repositoryClone and scan repository content
write_repositoryPost merge request comments (optional)

Access Levels

GitLab RoleCan ConnectCan ScanMR Comments
OwnerYesYesYes
MaintainerYesYesYes
DeveloperLimitedYesYes
ReporterNoNoNo

Webhook Configuration

Automatic Setup

Cloudgeni automatically configures webhooks when you connect a repository. Webhooks trigger on:
  • Push events to monitored branches
  • Merge request creation and updates
  • Tag push events

Manual Configuration

If automatic setup fails, configure webhooks manually:
  1. Go to your GitLab project → SettingsWebhooks
  2. Add webhook URL: https://api.cloudgeni.ai/webhooks/gitlab
  3. Select triggers:
    • Push events
    • Merge request events
  4. Add secret token (provided in Cloudgeni dashboard)
  5. Click Add webhook

Webhook Events

EventTrigger
PushCode pushed to repository
Merge RequestMR opened, updated, or merged
Tag PushNew tag created

Repository Management

Adding Repositories

  1. Go to SettingsIaC Repositories
  2. Find your GitLab integration
  3. Click Manage Repositories
  4. Toggle additional repositories on
  5. Click Save

Removing Repositories

  1. Go to SettingsIaC Repositories
  2. Find the repository to remove
  3. Click the menu → Remove
  4. Confirm removal
Removing a repository deletes all associated scan history and findings.

Repository Settings

Configure per-repository settings:
SettingDescription
Default BranchBranch to scan on push events
Scan TriggersWhich events trigger scans
MR CommentsEnable/disable merge request comments
Auto-remediationEnable AI-powered fix suggestions

Merge Request Integration

How It Works

When a merge request is opened or updated:
  1. Cloudgeni receives webhook notification
  2. Changed IaC files are analyzed
  3. Security findings are posted as MR comments
  4. Overall status is updated

Comment Format

MR comments include:
  • Summary of findings by severity
  • Inline comments on specific lines
  • Remediation suggestions
  • Links to detailed findings

Configuring MR Reviews

  1. Go to repository settings in Cloudgeni
  2. Enable Merge Request Reviews
  3. Configure severity thresholds
  4. Save settings

GitLab CI Integration

Combine repository connection with CI/CD scanning:
# .gitlab-ci.yml
stages:
  - security

cloudgeni-scan:
  stage: security
  image: cloudgeni/scanner:latest
  script:
    - cloudgeni scan --api-key $CLOUDGENI_API_KEY
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
See GitLab CI Integration for detailed setup.

Troubleshooting

OAuth Failed:
  • Clear browser cookies and retry
  • Verify you have Owner/Maintainer access
  • Check GitLab account isn’t blocked
Repositories Not Showing:
  • Ensure you have access to the group/project
  • Check repository visibility settings
  • Try refreshing the repository list
Self-Hosted Connection Failed:
  • Verify GitLab URL is accessible
  • Check SSL certificate validity
  • Ensure outbound network access to Cloudgeni
Webhooks Not Triggering:
  • Verify webhook is configured in GitLab
  • Check webhook URL is correct
  • Review webhook delivery history in GitLab
MR Comments Not Appearing:
  • Verify write permissions are granted
  • Check MR reviews are enabled
  • Review scan logs for errors
Scans Not Running:
  • Verify repository contains IaC files
  • Check default branch is correct
  • Review scan trigger settings
Partial Scan Results:
  • Some files may be excluded by .gitignore
  • Check for unsupported file formats
  • Review scan logs for skipped files

Security Considerations

Token Storage

  • OAuth tokens are encrypted at rest
  • Tokens are never logged or exposed
  • Access can be revoked from GitLab at any time

Data Access

Cloudgeni accesses:
  • Repository file contents (for scanning)
  • Merge request metadata (for comments)
  • Branch and commit information
Cloudgeni does not access:
  • GitLab user credentials
  • CI/CD variables or secrets
  • Issue or wiki content

Revoking Access

To disconnect GitLab:
  1. In Cloudgeni: SettingsIaC RepositoriesDisconnect
  2. In GitLab: User SettingsApplications → Revoke Cloudgeni