portal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

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

Index

Constants

View Source
const (
	StatusSucceeded = "Succeeded"
	StatusFailed    = "Failed"
	StatusTimeout   = "Timeout"
	StatusCancelled = "Cancelled"
	StatusRunning   = "Running"
)
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), opts ...ClientOption,
) (*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 ClientOption added in v0.4.0

type ClientOption func(*Client)

ClientOption configures a Client.

func WithHTTPClient added in v0.4.0

func WithHTTPClient(c *http.Client) ClientOption

WithHTTPClient overrides the HTTP client used for requests. Intended for tests that use httptest servers with self-signed certificates.

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 PipelineRunFilter added in v0.4.0

type PipelineRunFilter struct {
	Project  string // app.edp.epam.com/codebase
	PRNumber int    // app.edp.epam.com/git-change-number
	Author   string // app.edp.epam.com/git-author
	Branch   string // app.edp.epam.com/git-branch
	Type     string // app.edp.epam.com/pipelinetype (review, build)
	Status   string // summary.status (succeeded, failed, running, timeout, cancelled)
}

PipelineRunFilter holds composable filter criteria for listing pipeline runs. Multiple filters are combined with AND logic in the CEL query.

type PipelineRunGetOptions added in v0.4.0

type PipelineRunGetOptions struct {
	IncludeLogs   bool
	IncludeReason bool
}

PipelineRunGetOptions controls expansion for Get.

type PipelineRunInfo added in v0.4.0

type PipelineRunInfo struct {
	Name         string `json:"name"`
	PortalURL    string `json:"portalUrl,omitempty"`
	Status       string `json:"status"`
	Pipeline     string `json:"pipeline"`
	Project      string `json:"project"`
	Branch       string `json:"branch,omitempty"`
	PRNumber     string `json:"prNumber,omitempty"`
	PRURL        string `json:"prUrl,omitempty"`
	Author       string `json:"author,omitempty"`
	Type         string `json:"type,omitempty"`
	StartTime    string `json:"startTime"`
	Duration     string `json:"duration,omitempty"`
	TargetBranch string `json:"targetBranch,omitempty"`
	CommitSHA    string `json:"commitSha,omitempty"`
}

PipelineRunInfo holds the display data for a single pipeline run.

type PipelineRunListOptions added in v0.4.0

type PipelineRunListOptions struct {
	Filter        PipelineRunFilter
	IncludeLogs   bool
	IncludeReason bool
}

PipelineRunListOptions controls filtering and expansion for List.

type PipelineRunListResult added in v0.4.0

type PipelineRunListResult struct {
	PipelineRuns []PipelineRunInfo `json:"pipelineRuns"`
	Logs         string            `json:"logs,omitempty"`
	Tasks        []TaskRunInfo     `json:"tasks,omitempty"`
}

PipelineRunListResult is the full output for the pipelinerun list command.

type PipelineRunService added in v0.4.0

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

PipelineRunService provides access to pipeline run data via the portal's Tekton Results tRPC API.

func NewPipelineRunService added in v0.4.0

func NewPipelineRunService(client *Client, portalURL, clusterName, namespace string) *PipelineRunService

NewPipelineRunService creates a PipelineRunService.

func (*PipelineRunService) Get added in v0.4.0

Get returns a single pipeline run by name.

func (*PipelineRunService) List added in v0.4.0

List returns pipeline runs matching the given filters. When PRNumber filter is set, the most recent run is auto-expanded with failure details.

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.

type TaskRunInfo added in v0.4.0

type TaskRunInfo struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	Duration   string `json:"duration,omitempty"`
	FailedStep string `json:"failedStep,omitempty"`
	ExitCode   int    `json:"exitCode,omitempty"`
	Message    string `json:"message,omitempty"`
	Logs       string `json:"logs,omitempty"`
}

TaskRunInfo holds the display data for a single task run.

Jump to

Keyboard shortcuts

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