glab-ctl

command module
v0.0.0-...-d52c0f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: MIT Imports: 1 Imported by: 0

README ΒΆ

glab-ctl

A powerful command-line tool for GitLab group management and security auditing.

Overview

glab-ctl provides two main features:

  1. Sync: Clone and update all projects from GitLab groups to your local filesystem
  2. Audit: Evaluate GitLab projects against security and best-practice standards

Quick Start

Installation
# Using Go install
go install gitlab.com/rfussien/glab-ctl@latest

# Or from source
git clone https://gitlab.com/rfussien/glab-ctl.git
cd glab-ctl
go build -o glab-ctl
Initial Setup

On first run, the tool will interactively prompt for configuration:

glab-ctl sync  # Will prompt for GitLab token, SSH key, group ID, and local path
Basic Usage
# Sync all projects from a GitLab group
glab-ctl sync

# Audit a group for security and best practices
glab-ctl audit -g 12345 -f markdown -o report.md

# Manage configuration
glab-ctl config get
glab-ctl config set private_token

Features

Sync
  • πŸ”„ Pull mode with automatic updates
  • πŸ“ Maintains GitLab namespace structure locally
  • 🚫 Skips archived projects automatically
  • ⚑ Concurrent cloning (10 workers)
  • πŸ” Smart retry logic for failed operations
  • πŸ—‘οΈ Prune stale local repos with --prune (prompts before each deletion)
Audit
  • πŸ” 60+ automated checks across 8 domains
  • πŸ“Š Weighted scoring system (0-100)
  • 🎯 Implements 16 OpenSSF SCM best practices
  • πŸ”’ Security scanning verification
  • πŸ“ˆ Multiple output formats (JSON, Markdown, Table)
  • ⚑ Concurrent auditing (configurable workers)
  • πŸšͺ Hard gates for critical security issues
Audit Domains
Domain Checks Focus
AI 2 AI assistant context files (CLAUDE.md, AGENTS.md, .cursor/rules/, …)
Metadata 7 Documentation, README, LICENSE, topics
Governance 7 CODEOWNERS, maintainers, webhooks, activity
Merge Controls 18 Branch protection, code review, approvals
CI/CD 6 Pipeline config, templates, variables
Security 13 SAST, dependency scanning, vulnerabilities
Hygiene 5 Stale branches, unused features, activity
Standardization 6 Conventional commits, templates, labels

Documentation

Getting Started
Commands
Reference

Examples

Sync Examples
# Sync all projects from configured group
glab-ctl sync

# Sync a specific group (one-time override)
glab-ctl sync -g 12345

# Sync and remove local repos deleted on GitLab
glab-ctl sync --prune
Update Examples
# Update to the latest release
glab-ctl update

# Check current version
glab-ctl version
Audit Examples
# Basic group audit with table output
glab-ctl audit -g 12345 -f table

# Audit with strict security requirements
glab-ctl audit -g 12345 --fail-on critical --min-score 80

# Comprehensive audit with Markdown report
glab-ctl audit -g 12345 \
  --include-subgroups \
  --fail-on medium \
  --min-score 75 \
  -f markdown \
  -o compliance-report.md

# Audit a single project
glab-ctl audit -p 67890 -f json

Requirements

  • Go 1.26 or higher
  • GitLab account with API access
  • GitLab Personal Access Token with api scope (Owner-level role required for audit)
  • SSH key configured for GitLab (only required for sync)

Configuration

Configuration is stored in ~/.config/glab-ctl/config.yaml (mode 0600):

private_token: "your-gitlab-token"
ssh_private_key: "/path/to/your/ssh/key"
root_group_id: "12345"
source_path: "/path/to/local/repos"

Setting the GITLAB_TOKEN environment variable overrides private_token β€” useful for CI runs and secret-manager workflows (1Password CLI, pass, direnv).

See Configuration Guide for details.

Project Structure

Projects are synchronized to match GitLab's namespace structure:

~/src/gitlab.com/
β”œβ”€β”€ group-name/
β”‚   β”œβ”€β”€ project1/
β”‚   β”œβ”€β”€ project2/
β”‚   └── subgroup/
β”‚       β”œβ”€β”€ project3/
β”‚       └── project4/

CI/CD Integration

The audit command provides exit codes for CI/CD pipelines:

audit:
  stage: compliance
  variables:
    GITLAB_TOKEN: $GITLAB_TOKEN  # CI/CD masked variable, owner-level scope
  script:
    - glab-ctl audit -g $CI_PROJECT_NAMESPACE_ID \
        -f markdown \
        -o audit-report.md \
        --fail-on high \
        --min-score 70
  artifacts:
    paths:
      - audit-report.md
    when: always
  only:
    - schedules

OpenSSF Compliance

glab-ctl audit implements 16 OpenSSF SCM best practices for GitLab, including:

  • Default branch protection and force-push prevention
  • Required code review with minimum two approvers
  • Pipeline success requirements
  • Signed commit verification
  • Limited ownership (fewer than 3 owners)
  • Webhook SSL verification
  • And more...

See Audit Command Documentation for the complete list.

Contributing

Contributions are welcome! Please see:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL