Documentation
¶
Overview ¶
Package portal provides a client for the KubeRocketCI Portal tRPC API.
Index ¶
- Constants
- Variables
- type APIError
- type Client
- type ClientOption
- type Config
- type Deployment
- type DeploymentDetail
- type DeploymentService
- type PipelineRunFilter
- type PipelineRunGetOptions
- type PipelineRunInfo
- type PipelineRunListOptions
- type PipelineRunListResult
- type PipelineRunService
- type Project
- type ProjectService
- type QualityGate
- type Stage
- type TaskRunInfo
Constants ¶
const ( StatusSucceeded = "Succeeded" StatusFailed = "Failed" StatusTimeout = "Timeout" StatusCancelled = "Cancelled" StatusRunning = "Running" )
const ( QualityGateTypeAutotests = "autotests" QualityGateTypeManual = "manual" )
Quality gate type constants.
Variables ¶
var ( 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 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.
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 ¶
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
func (s *DeploymentService) Get(ctx context.Context, name string) (*DeploymentDetail, error)
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
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
func (s *PipelineRunService) Get( ctx context.Context, name string, opts PipelineRunGetOptions, ) (*PipelineRunListResult, error)
Get returns a single pipeline run by name.
func (*PipelineRunService) List ¶ added in v0.4.0
func (s *PipelineRunService) List(ctx context.Context, opts PipelineRunListOptions) (*PipelineRunListResult, error)
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.
type QualityGate ¶ added in v0.3.0
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.