Documentation
¶
Index ¶
- Constants
- Variables
- func FetchOIDCConfig(portalURL string) (string, error)
- func IsFailureStatus(status string) bool
- type ClusterConfig
- 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" )
Variables ¶
var ( 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
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
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
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
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
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
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.
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.
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.