cli

module
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0

README

KubeRocketCI CLI

❗ Please refer to the KubeRocketCI documentation to get the notion of the main concepts and guidelines.

krci is the command-line companion for the KubeRocketCI platform — inspect projects, deployments, pipeline runs, and SonarQube state straight from the terminal, with JSON output ready for agent workflows.

From chat to fix — CLI + AI agent

krci is built to pair with an AI coding assistant (Claude Code, Cursor, Copilot CLI, etc.). Every data command emits predictable JSON under -o json, so an agent can discover resources by filter (no hard-coded names) and then drill in — a list → get chain the agent plans on its own from your natural-language question.

"Check all my PRs that have failed and analyze the logs"
# 1. Discover failed runs for the author — no run names needed up front
krci run list --author "jane" --status failed -o json

# 2. For each name in .pipelineRuns[].name, fan out a diagnosis:
#    task tree + failed step + relevant log lines
krci run get <name> --reason -o json
"What's the reason the pipeline is failing on PR 44?"
# --reason on list targets the most recent matching run automatically,
# so the agent never has to know the run name
krci run list --project my-app --pr 44 --reason -o json
"Check quality gates for each of my projects"
# sonar list already carries the per-project quality-gate verdict
krci sonar list -o json | jq '.data.projects[] | {key, qualityGateStatus}'

# Drill into any red ones
krci sonar gate <key> -o json
krci sonar issues <key> --severity BLOCKER,CRITICAL -o json
"Is keycloak-operator healthy right now?"
# One-shot snapshot: measures + gate + top offenders
krci sonar get keycloak-operator -o json
krci sonar issues keycloak-operator --severity BLOCKER,CRITICAL -o json
Target state

Questions we want the agent to answer next, keeping the same list-then-drill pattern:

# "On which environments is version 1.4.2 of payments-api deployed?"
# "Which deployments include the payments-api application?"
# "Show me the promotion history for my-pipeline."

Why this works: the CLI only talks to the KubeRocketCI Portal (no direct cluster access), tokens stay encrypted on disk, and the JSON shapes are stable enough to treat krci as a first-class agent tool.

What it does

Area What you get Docs
Authentication OIDC + PKCE browser flow, AES-256-GCM token storage, OS keyring integration docs/auth.md
Projects List and inspect Codebase resources docs/project.md
Deployments Inspect CDPipeline resources, their apps, environments, and promotion gates docs/deployment.md
Pipeline runs List, filter, stream logs, and diagnose failures across Tekton runs docs/pipelinerun.md
SonarQube Projects, quality gates, measures, and issues via the Portal's Sonar binding docs/sonar.md

Every data command accepts -o table (default) or -o json. Tables render nicely on a TTY, plain text into pipes, JSON for automation.

Install

brew tap KubeRocketCI/homebrew-tap
brew install krci

Or grab a binary from GitHub Releases.

30-second tour

# Sign in
krci auth login --portal-url https://portal.example.com

# See what's there
krci project list
krci deployment list
krci pipelinerun list --project keycloak-operator

# Diagnose a failing run
krci run list --project keycloak-operator --pr 336 --reason

# Check a SonarQube gate
krci sonar gate keycloak-operator

Each command has a --help page. Deeper walk-throughs live in docs/ — start with the area you care about.

Commands

krci [--portal-url <url>]
  auth        login | status | logout
  project     list | get <name>
  deployment  list | get <name>
  pipelinerun list | get <name>       (also filters, --logs, --reason)
  sonar       list | get | gate | issues <project>
  version

Aliases: projectproj, deploymentdp, pipelinerunrun

Configuration

Flag Env Description
--portal-url KRCI_PORTAL_URL KubeRocketCI Portal URL

Issuer URL, cluster name, and namespace are auto-discovered from the Portal on auth login.

Path Purpose
~/.config/krci/config.yaml Portal URL and discovered metadata
~/.config/krci/tokens.enc AES-encrypted tokens; key lives in keyring

Build from source

make build        # → dist/krci
make ci           # lint → test → build

Requires Go 1.26+. For running against a local portal, see docs/development.md.

License

Apache License 2.0

Directories

Path Synopsis
cmd
krci command
Package main is the entry point for the krci CLI.
Package main is the entry point for the krci CLI.
internal
auth
Package auth provides OIDC authentication for the krci CLI.
Package auth provides OIDC authentication for the krci CLI.
cmdutil
Package cmdutil provides shared CLI utilities, including the Factory dependency container.
Package cmdutil provides shared CLI utilities, including the Factory dependency container.
config
Package config provides configuration loading for the krci CLI.
Package config provides configuration loading for the krci CLI.
iostreams
Package iostreams provides I/O stream abstractions for CLI commands.
Package iostreams provides I/O stream abstractions for CLI commands.
output
Package output provides rendering utilities for CLI command output.
Package output provides rendering utilities for CLI command output.
portal/restapi
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.
ptr
token
Package token provides encrypted token persistence for the krci CLI.
Package token provides encrypted token persistence for the krci CLI.
pkg
cmd/auth
Package auth implements the "krci auth" command group.
Package auth implements the "krci auth" command group.
cmd/auth/login
Package login implements the "krci auth login" command.
Package login implements the "krci auth login" command.
cmd/auth/logout
Package logout implements the "krci auth logout" command.
Package logout implements the "krci auth logout" command.
cmd/auth/status
Package status implements the "krci auth status" command.
Package status implements the "krci auth status" command.
cmd/deployment
Package deployment implements the "krci deployment" command group.
Package deployment implements the "krci deployment" command group.
cmd/deployment/get
Package get implements the "krci deployment get" command.
Package get implements the "krci deployment get" command.
cmd/deployment/list
Package list implements the "krci deployment list" command.
Package list implements the "krci deployment list" command.
cmd/env
Package env implements the "krci env" command group.
Package env implements the "krci env" command group.
cmd/env/get
Package get implements the "krci env get" command.
Package get implements the "krci env get" command.
cmd/env/list
Package list implements the "krci env list" command.
Package list implements the "krci env list" command.
cmd/internal/cmdtest
Package cmdtest provides shared helpers for verb-level command tests.
Package cmdtest provides shared helpers for verb-level command tests.
cmd/internal/discovery
Package discovery holds helpers shared by the deployment-discovery verbs (`krci env list`, `krci env get`, `krci project deployments`): DNS-1123 validation, output-format dispatch, JSON envelope rendering, and shared error promotion.
Package discovery holds helpers shared by the deployment-discovery verbs (`krci env list`, `krci env get`, `krci project deployments`): DNS-1123 validation, output-format dispatch, JSON envelope rendering, and shared error promotion.
cmd/pipelinerun
Package pipelinerun implements the "krci pipelinerun" command group.
Package pipelinerun implements the "krci pipelinerun" command group.
cmd/pipelinerun/get
Package get implements the "krci pipelinerun get" command.
Package get implements the "krci pipelinerun get" command.
cmd/pipelinerun/list
Package list implements the "krci pipelinerun list" command.
Package list implements the "krci pipelinerun list" command.
cmd/project
Package project implements the "krci project" command group.
Package project implements the "krci project" command group.
cmd/project/deployments
Package deployments implements the "krci project deployments <project>" command.
Package deployments implements the "krci project deployments <project>" command.
cmd/project/get
Package get implements the "krci project get" command.
Package get implements the "krci project get" command.
cmd/project/list
Package list implements the "krci project list" command.
Package list implements the "krci project list" command.
cmd/root
Package root assembles the top-level cobra.Command for the krci CLI.
Package root assembles the top-level cobra.Command for the krci CLI.
cmd/sca
Package sca implements the "krci sca" command group (Software Composition Analysis views backed by Dependency-Track).
Package sca implements the "krci sca" command group (Software Composition Analysis views backed by Dependency-Track).
cmd/sca/components
Package components implements the "krci sca components" command.
Package components implements the "krci sca components" command.
cmd/sca/findings
Package findings implements the "krci sca findings" command.
Package findings implements the "krci sca findings" command.
cmd/sca/get
Package get implements the "krci sca get" command.
Package get implements the "krci sca get" command.
cmd/sca/internal
Package scainternal holds helpers shared by `krci sca` verbs (validation, enum sets, render/format dispatch, error-envelope plumbing).
Package scainternal holds helpers shared by `krci sca` verbs (validation, enum sets, render/format dispatch, error-envelope plumbing).
cmd/sca/internal/scatestutil
Package scatestutil exposes helpers shared by every `krci sca <verb>` test package — primarily a Factory stub wired to in-memory streams and a nil portal client suitable for RunE plumbing tests.
Package scatestutil exposes helpers shared by every `krci sca <verb>` test package — primarily a Factory stub wired to in-memory streams and a nil portal client suitable for RunE plumbing tests.
cmd/sca/list
Package list implements the "krci sca list" command.
Package list implements the "krci sca list" command.
cmd/sonar
Package sonar implements the "krci sonar" command group.
Package sonar implements the "krci sonar" command group.
cmd/sonar/gate
Package gate implements the "krci sonar gate" command.
Package gate implements the "krci sonar gate" command.
cmd/sonar/get
Package get implements the "krci sonar get" command.
Package get implements the "krci sonar get" command.
cmd/sonar/internal
Package sonarinternal holds helpers shared by `krci sonar` verbs (validation, enum sets, render/format dispatch, error-envelope plumbing).
Package sonarinternal holds helpers shared by `krci sonar` verbs (validation, enum sets, render/format dispatch, error-envelope plumbing).
cmd/sonar/issues
Package issues implements the "krci sonar issues" command.
Package issues implements the "krci sonar issues" command.
cmd/sonar/list
Package list implements the "krci sonar list" command.
Package list implements the "krci sonar list" command.
cmd/version
Package version implements the "krci version" command.
Package version implements the "krci version" command.

Jump to

Keyboard shortcuts

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