Skip to main content

OpenSource CLI

The Plumber CLI allows you to analyze GitLab CI/CD pipelines from the command line. This is useful for local testing, CI/CD integration, or automated compliance checks.

View on GitHub

Installation

Quick Start

  1. Generate a config file

    Terminal window
    plumber generate config

    This creates .plumber.yaml with default compliance rules. You can customize it later.

  2. Create and set your GitLab token

    In GitLab, go to User Settings → Access Tokens (direct link) and create a Personal Access Token with read_api + read_repository scopes:

    Terminal window
    export GITLAB_TOKEN=glpat-xxxx

    Tip

    You can also use a project or group access token if you prefer scoped permissions.

  3. Run analysis

    Terminal window
    plumber analyze \
    --gitlab-url https://gitlab.com \
    --project mygroup/myproject
  4. Review results

    Plumber reads your .plumber.yaml config and outputs a compliance report. You can also tell it to store the output in JSON format with the --output flag.

Command Reference

plumber analyze

The main command for analyzing GitLab CI/CD pipelines.

Terminal window
plumber analyze [flags]

Flags

FlagRequiredDefaultDescription
--gitlab-urlYes-GitLab instance URL (e.g., https://gitlab.com)
--projectYes-Project path (e.g., group/project)
--configNo.plumber.yamlPath to configuration file
--thresholdNo100Minimum compliance % to pass (0-100)
--branchNoProject defaultBranch to analyze
--outputNo-Write JSON results to file
--printNotruePrint text output to stdout

Environment Variables

VariableRequiredDescription
GITLAB_TOKENYesGitLab API token with read_api and read_repository scopes

Exit Codes

CodeMeaning
0Passed (compliance ≥ threshold)
1Failed (compliance < threshold or error)

plumber generate config

Generate a default .plumber.yaml configuration file.

Terminal window
plumber generate config [flags]
FlagDefaultDescription
--output, -o.plumber.yamlOutput file path
--force, -ffalseOverwrite existing file

Examples:

Terminal window
# Generate default config
plumber generate config
# Custom filename
plumber generate config --output my-plumber.yaml
# Overwrite existing file
plumber generate config --force

Usage Examples

Save JSON Output

Terminal window
docker run --rm \
-e GITLAB_TOKEN=glpat-xxxx \
-v $(pwd):/output \
getplumber/plumber:latest analyze \
--gitlab-url https://gitlab.com \
--project mygroup/myproject \
--branch main \
--config /.plumber.yaml \
--threshold 100 \
--output /output/results.json

Self-Hosted GitLab

Terminal window
plumber analyze \
--gitlab-url https://gitlab.example.com \
--project mygroup/myproject \
--branch develop \
--config .plumber.yaml \
--threshold 80

Silent Mode (JSON Only)

Terminal window
plumber analyze \
--gitlab-url https://gitlab.com \
--project mygroup/myproject \
--config .plumber.yaml \
--threshold 100 \
--output results.json \
--print false

Example Output

Tip

The CLI output is color-coded in your terminal for easy scanning - green for passing controls, red for failures.

Plumber CLI output showing compliance results

Tip

When using --output, results are saved as JSON for programmatic access and CI/CD integration.

Configuration

Plumber uses a .plumber.yaml configuration file to customize checks.

Tip

See the Configuration section for full details.

version: "1.0"
controls:
imageMutable:
enabled: true
mutableTags:
- latest
- dev
imageUntrusted:
enabled: true
trustDockerHubOfficialImages: true
trustedUrls:
- registry.gitlab.com/*
- $CI_REGISTRY_IMAGE:*
branchProtection:
enabled: true
defaultMustBeProtected: true
namePatterns:
- main
- release/*

Troubleshooting

IssueSolution
GITLAB_TOKEN environment variable is requiredSet the GITLAB_TOKEN environment variable with a valid GitLab token
401 UnauthorizedCheck that your token has read_api + read_repository scopes
403 Forbidden on MR settingsExpected on non-Premium GitLab; continues without that data
404 Not FoundVerify the project path and GitLab URL are correct
Configuration file not foundEnsure the path to .plumber.yaml is correct (use absolute path in Docker)

Info

Need help? Open an issue on GitHub or join our Discord.