Skip to content

KubeRocketCI/cli

Repository files navigation

KubeRocketCI CLI

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

Command-line interface for the KubeRocketCI platform — enables developers and AI agents to manage projects, deployments, and environments from the terminal.

Overview

krci is a CLI client that interacts with KubeRocketCI platform resources via the KubeRocketCI Portal API. It provides secure OIDC-based authentication and styled terminal output for human users, with JSON output for automation and AI agent workflows.

Features

  • Authentication — OIDC Authorization Code + PKCE flow, encrypted token storage (AES-256-GCM), OS keyring integration
  • Projects — List and inspect Codebase resources
  • Deployments — List and inspect CDPipeline and Stage resources
  • Pipeline Runs — List, filter, diagnose failures, and stream logs
  • Output — Styled tables for terminals, plain text for pipes, JSON for automation

Installation

brew tap KubeRocketCI/homebrew-tap
brew install krci

Or download a binary from GitHub Releases.

Quick Start

# Authenticate with your KubeRocketCI instance
krci auth login --portal-url https://portal.example.com

# Check auth status
krci auth status

# List projects
krci project list

# Get project details
krci project get my-app

# List deployments
krci deployment list

# Get deployment details
krci deployment get my-pipeline

# List recent pipeline runs
krci pipelinerun list

# Filter by project, PR, status, author, type
krci pipelinerun list --project my-app --pr 44
krci pipelinerun list --status failed --type review
krci pipelinerun list --project my-app --author "John Doe"

# Diagnose why a pipeline failed
krci pipelinerun list --project my-app --pr 44 --reason

# Get a specific pipeline run's logs
krci pipelinerun get review-my-app-main-a1b2c3 --logs

# JSON output for scripting
krci project list -o json

Commands

krci [--portal-url <url>]
  auth login              Authenticate via browser (OIDC)
  auth status             Show authentication state
  auth logout             Clear stored credentials
  project list|ls         List projects
  project get <name>      Show project details
  deployment list|ls      List deployments
  deployment get <name>   Show deployment details
  pipelinerun list|ls     List and filter pipeline runs
  pipelinerun get <name>  Get a specific pipeline run
  version                 Print version info

Aliases: projectproj, deploymentdp, pipelinerunrun

Pipeline Run Filters

All filters combine with AND logic.

Flag Description
--project Filter by project name
--pr Filter by pull request number
--author Filter by author name
--branch Filter by source branch
--type Filter by type (review, build, deploy, release)
--status Filter by status (succeeded, failed, running, timeout, cancelled)
--logs Append logs for the most recent run
--reason Show task tree and failure diagnosis

Inspecting a Specific Pipeline Run

Use get to inspect a specific run by name (from list -o json or the table output):

# Basic info
krci run get review-my-app-main-a1b2c3

# Full logs
krci run get review-my-app-main-a1b2c3 --logs

# Failure diagnosis (task tree + failed step + logs)
krci run get review-my-app-main-a1b2c3 --reason

Diagnosing Failed Pipelines

Use --reason on either list or get for a full diagnosis — task tree, failed step, and relevant logs:

# From the list (targets most recent run matching filters)
krci run list --project my-app --pr 44 --reason

# Or by specific name
krci run get review-my-app-main-a1b2c3 --reason
Pipeline: review-my-app-main-a1b2c3
  Status:   Failed
  Duration: 3m 14s

Tasks:
  ✓ fetch-repository             Succeeded   11s
  ✓ build                        Succeeded   2m 8s
  ✗ sonar                        Failed      52s
  ✓ helm-lint                    Succeeded   8s

Failed: sonar
  Step:    sonar-scanner (exit code 2)
  Message: "step-sonar-scanner" exited with code 2

Logs: sonar
  [sonar-scanner] ERROR: QUALITY GATE STATUS: FAILED

For AI agents, use JSON output and filter failed tasks:

krci run get review-my-app-main-a1b2c3 --reason -o json | jq '.tasks[] | select(.failedStep)'

Global Flag

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

All other settings (issuer URL, cluster name, namespace) are auto-discovered on login.

Output Flag

All data commands accept -o, --output with values table (default) or json.

Configuration

Config file: ~/.config/krci/config.yaml (auto-populated on login). Token storage: ~/.config/krci/tokens.enc (AES-encrypted, key in OS keyring).

Prerequisites

  • Go 1.26+ (for building from source)
  • Access to a KubeRocketCI instance with an OIDC provider configured

Building

make build

License

Apache License 2.0

Related Articles

About

Command-line interface for KubeRocketCI platform - enables developers and AI agents to manage projects, deployments, pipelines, and environments from the terminal

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors