Skip to content

agrechin/glreporter

Repository files navigation

glreporter

glreporter is the CLI tool to fetch information from GitLab groups and projects.

license

Features

  • Collect information about GitLab groups and their projects.
  • Fetch CI/CD variables from projects and groups.
  • Manage access tokens (group, project, and pipeline trigger tokens).
  • Filter by group ID and project status.
  • Output in a JSON, table, or CSV format.

Installation

go install

go install github.com/andreygrechin/glreporter@latest

Homebrew tap

You may also install the latest version of glreporter using the Homebrew tap:

brew install andreygrechin/tap/glreporter

# to update, run
brew update
brew upgrade glreporter

Manually

Download the pre-compiled binaries from the releases page and copy them to a desired location.

Usage

Available Commands

# View help for all commands
glreporter --help

# Generate shell completion
glreporter completion <shell>

Groups and Projects

# Fetch all accessible groups
glreporter groups

# Fetch groups recursively from a specific group
glreporter groups --group-id <group-id>

# Fetch projects from all accessible groups
glreporter projects

# Fetch projects from a specific group and its subgroups
glreporter projects --group-id <group-id>

Token Management

# Fetch group access tokens (from all subgroups by default)
glreporter tokens gat --group-id <group-id>

# Include inactive group access tokens
glreporter tokens gat --group-id <group-id> --include-inactive

# Fetch project access tokens from all accessible groups
glreporter tokens pat

# Fetch project access tokens for all projects in a specific group
glreporter tokens pat --group-id <group-id>

# Fetch project access tokens for a specific project
glreporter tokens pat --project-id <project-id>

# Include inactive project access tokens
glreporter tokens pat --group-id <group-id> --include-inactive

# Fetch pipeline trigger tokens from all accessible groups
glreporter tokens ptt

# Fetch pipeline trigger tokens for all projects in a specific group
glreporter tokens ptt --group-id <group-id>

# Fetch pipeline trigger tokens for a specific project
glreporter tokens ptt --project-id <project-id>

Variable Management

# Fetch all variables (both project and group CI/CD variables)
glreporter variables all

# Fetch all variables from a specific group recursively
glreporter variables all --group-id <group-id>

# Fetch all variables for a specific project
glreporter variables all --project-id <project-id>

# Fetch only group variables from all accessible groups
glreporter variables group

# Fetch group variables from a specific group recursively
glreporter variables group --group-id <group-id>

# Fetch only project variables from all accessible groups
glreporter variables project

# Fetch project variables from a specific group recursively
glreporter variables project --group-id <group-id>

# Fetch project variables for a specific project
glreporter variables project --project-id <project-id>

# Include variable values in output (excluded by default for security)
glreporter variables all --include-values

Global Flags

--format <format>     # Output format: table (default), json, or csv
--token <token>       # GitLab personal access token (or use GITLAB_TOKEN env var)
--debug               # Enable debug logging

Command-Specific Flags

--group-id <group-id>         # GitLab group ID or path with namespace (optional, fetches info from all accessible groups if not provided)
--project-id <project-id>     # GitLab project ID or path with namespace (alternative to group-id for project-specific commands)
--include-inactive            # Include inactive tokens in output (token commands only)
--include-values              # Include variable values in output (variable commands only, excluded by default for security)

Group and Project ID Formats

The --group-id and --project-id flags accept multiple formats:

  • Numeric ID: 12345678 (traditional numeric identifier)
  • Path with namespace: org/subgroup or org/subgroup/project (GitLab namespace path)

Examples:

# Using numeric ID
glreporter groups --group-id 12345678

# Using namespace path
glreporter groups --group-id gitlab-org/gitlab

# Project examples
glreporter tokens pat --project-id org/project-name

Note: For token commands, use either --group-id (to fetch from all projects in a group) or --project-id (to fetch from a specific project), but not both. If neither is provided, the command will fetch tokens from all accessible groups or projects.

Output Formats

  • Table: Human-readable format with limited fields
  • JSON/CSV: Complete raw API response data

Authentication

The tool authenticates with the GitLab API using a personal access token (PAT). The token can be provided via:

  • Command-line flag: --token <token>
  • Environment variable: GITLAB_TOKEN

License

This project is licensed under the MIT License.

SPDX-License-Identifier: MIT

About

CLI tool to inventory management of GitLab groups and projects

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors