portal

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StatusSucceeded = "Succeeded"
	StatusFailed    = "Failed"
	StatusTimeout   = "Timeout"
	StatusCancelled = "Cancelled"
	StatusRunning   = "Running"
)
View Source
const (
	QualityGateTypeAutotests = "autotests"
	QualityGateTypeManual    = "manual"
)

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

func FetchOIDCConfig added in v0.5.0

func FetchOIDCConfig(portalURL string) (string, error)

FetchOIDCConfig calls the public /rest/v1/config/oidc endpoint (no auth) and returns the OIDC issuer URL for pre-login discovery. The portal URL must use HTTPS.

func IsFailureStatus added in v0.5.0

func IsFailureStatus(status string) bool

Types

type ClusterConfig added in v0.5.0

type ClusterConfig struct {
	ClusterName      string `json:"clusterName"`
	DefaultNamespace string `json:"defaultNamespace"`
}

ClusterConfig holds configuration returned by the authenticated config endpoint.

func FetchClusterConfig added in v0.5.0

func FetchClusterConfig(portalURL, token string) (*ClusterConfig, error)

FetchClusterConfig calls the authenticated /rest/v1/config endpoint and returns cluster name and default namespace. 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 REST API.

func NewDeploymentService added in v0.3.0

func NewDeploymentService(client *restapi.ClientWithResponses, 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
	PRNumber int
	Author   string
	Branch   string
	Type     string
	Status   string
}

PipelineRunFilter holds composable filter criteria for listing pipeline runs.

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"`
}

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"`
}

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 REST API.

func NewPipelineRunService added in v0.4.0

func NewPipelineRunService(
	client *restapi.ClientWithResponses, 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.

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 REST API.

func NewProjectService added in v0.3.0

func NewProjectService(client *restapi.ClientWithResponses, 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"`
}

Directories

Path Synopsis
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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