portal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package portal provides a client for the KubeRocketCI Portal tRPC API.

Index

Constants

View Source
const (
	QualityGateTypeAutotests = "autotests"
	QualityGateTypeManual    = "manual"
)

Quality gate type constants.

Variables

View Source
var (
	ErrUnauthorized  = errors.New("unauthorized: please run 'krci auth login'")
	ErrNotFound      = errors.New("resource not found")
	ErrHTTPSRequired = errors.New("portal URL must use HTTPS")
)

Sentinel errors for portal API failures.

Functions

This section is empty.

Types

type APIError added in v0.3.0

type APIError struct {
	Code       string
	Message    string
	HTTPStatus int
}

APIError represents a tRPC error response from the portal.

func (*APIError) Error added in v0.3.0

func (e *APIError) Error() string

func (*APIError) Is added in v0.3.0

func (e *APIError) Is(target error) bool

type Client added in v0.3.0

type Client struct {
	// contains filtered or unexported fields
}

Client provides authenticated access to the KubeRocketCI Portal tRPC API.

func NewClient added in v0.3.0

func NewClient(portalURL string, tokenFunc func(context.Context) (string, error)) (*Client, error)

NewClient creates a portal tRPC client. tokenFunc returns the idToken for Bearer authentication. The portalURL must use HTTPS to prevent Bearer tokens from being sent in cleartext.

func (*Client) Query added in v0.3.0

func (c *Client) Query(ctx context.Context, procedure string, input any, out any) error

Query calls a tRPC query procedure (HTTP GET) and unmarshals the result into out.

type Config

type Config struct {
	ClusterName      string `json:"clusterName"`
	DefaultNamespace string `json:"defaultNamespace"`
	OIDCIssuerURL    string `json:"oidcIssuerUrl"`
}

Config holds public configuration returned by the Portal.

func FetchConfig

func FetchConfig(portalURL string) (*Config, error)

FetchConfig calls the Portal public config.get endpoint (no auth required) and returns the cluster configuration. The portal URL must use HTTPS.

type Deployment added in v0.3.0

type Deployment struct {
	Name         string   `json:"name"`
	Namespace    string   `json:"namespace"`
	Applications []string `json:"applications"`
	StageNames   []string `json:"stages"`
	Description  string   `json:"description,omitempty"`
	Status       string   `json:"status"`
	Available    bool     `json:"available"`
}

Deployment represents a KubeRocketCI CDPipeline resource.

type DeploymentDetail added in v0.3.0

type DeploymentDetail struct {
	Name         string   `json:"name"`
	Namespace    string   `json:"namespace"`
	Applications []string `json:"applications"`
	Description  string   `json:"description,omitempty"`
	Status       string   `json:"status"`
	Available    bool     `json:"available"`
	Stages       []Stage  `json:"stages"`
}

DeploymentDetail represents a CDPipeline with its associated Stages.

type DeploymentService added in v0.3.0

type DeploymentService struct {
	// contains filtered or unexported fields
}

DeploymentService provides access to CDPipeline and Stage resources via the portal API.

func NewDeploymentService added in v0.3.0

func NewDeploymentService(client *Client, clusterName, namespace string) *DeploymentService

NewDeploymentService creates a DeploymentService for the given cluster and namespace.

func (*DeploymentService) Get added in v0.3.0

Get returns a single CDPipeline with its Stages sorted by order.

func (*DeploymentService) List added in v0.3.0

func (s *DeploymentService) List(ctx context.Context) ([]Deployment, error)

List returns all CDPipelines with their stage names ordered by spec.order.

type Project added in v0.3.0

type Project struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Type      string `json:"type"`
	Language  string `json:"language"`
	BuildTool string `json:"buildTool"`
	Framework string `json:"framework,omitempty"`
	GitServer string `json:"gitServer"`
	GitURL    string `json:"gitUrl,omitempty"`
	Status    string `json:"status"`
	Available bool   `json:"available"`
}

Project represents a KubeRocketCI Codebase resource.

type ProjectService added in v0.3.0

type ProjectService struct {
	// contains filtered or unexported fields
}

ProjectService provides access to Codebase resources via the portal API.

func NewProjectService added in v0.3.0

func NewProjectService(client *Client, clusterName, namespace string) *ProjectService

NewProjectService creates a ProjectService for the given cluster and namespace.

func (*ProjectService) Get added in v0.3.0

func (s *ProjectService) Get(ctx context.Context, name string) (*Project, error)

Get returns a single Codebase by name.

func (*ProjectService) List added in v0.3.0

func (s *ProjectService) List(ctx context.Context) ([]Project, error)

List returns all Codebases in the configured namespace.

type QualityGate added in v0.3.0

type QualityGate struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

QualityGate represents a quality gate step within a Stage.

type Stage added in v0.3.0

type Stage struct {
	Name         string        `json:"name"`
	Order        int64         `json:"order"`
	TriggerType  string        `json:"triggerType"`
	QualityGates []QualityGate `json:"qualityGates"`
	Namespace    string        `json:"namespace"`
	ClusterName  string        `json:"clusterName,omitempty"`
	Description  string        `json:"description,omitempty"`
	Status       string        `json:"status"`
	Available    bool          `json:"available"`
}

Stage represents a KubeRocketCI Stage resource belonging to a CDPipeline.

Jump to

Keyboard shortcuts

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