Documentation
¶
Index ¶
- Constants
- Variables
- func FetchOIDCConfig(portalURL string) (string, error)
- func IsFailureStatus(status string) bool
- func ValidateBuildParams(params map[string]string) error
- func VerifySession(ctx context.Context, client *restapi.ClientWithResponses) error
- type AppCondition
- type AppOperation
- type ArgoHealthStatus
- type BuildInput
- type ClusterConfig
- type Deployment
- type DeploymentByProjectService
- type DeploymentDetail
- type DeploymentService
- type EnvDetail
- type EnvListFilters
- type EnvListPayload
- type EnvProject
- type EnvService
- type EnvSummary
- type ImageVersion
- type Infrastructure
- type PipelineRunFilter
- type PipelineRunGetOptions
- type PipelineRunInfo
- type PipelineRunListOptions
- type PipelineRunListResult
- type PipelineRunService
- func (s *PipelineRunService) Get(ctx context.Context, name string, opts PipelineRunGetOptions) (*PipelineRunListResult, error)
- func (s *PipelineRunService) List(ctx context.Context, opts PipelineRunListOptions) (*PipelineRunListResult, error)
- func (s *PipelineRunService) Wait(ctx context.Context, name string, opts PipelineRunGetOptions, ...) (*PipelineRunListResult, error)
- type PipelineRunStartService
- type Project
- type ProjectBuildService
- type ProjectDeploymentRow
- type ProjectDeploymentsPayload
- type ProjectService
- type ProjectVersionStream
- type ProjectVersionsPayload
- type ProjectVersionsService
- type QualityGate
- type QualityGateDetail
- type QualityGateStatus
- type SCAComponent
- type SCAComponentList
- type SCAComponentsParams
- type SCAFinding
- type SCAFindingAnalysis
- type SCAFindingAttribution
- type SCAFindingComponent
- type SCAFindingList
- type SCAFindingVulnerability
- type SCAFindingsParams
- type SCAListParams
- type SCAMetrics
- type SCAProject
- type SCAProjectDetail
- type SCAProjectList
- type SCAService
- func (s *SCAService) Components(ctx context.Context, params SCAComponentsParams) (*SCAComponentList, error)
- func (s *SCAService) Findings(ctx context.Context, params SCAFindingsParams) (*SCAFindingList, error)
- func (s *SCAService) Get(ctx context.Context, codebase, branch string) (*SCAProjectDetail, error)
- func (s *SCAService) List(ctx context.Context, params SCAListParams) (*SCAProjectList, error)
- type SCAStatus
- type SonarGate
- type SonarGateCondition
- type SonarGateProjectStatus
- type SonarIssue
- type SonarIssueList
- type SonarIssuesParams
- type SonarListParams
- type SonarPaging
- type SonarProject
- type SonarProjectDetail
- type SonarProjectList
- type SonarScope
- type SonarService
- func (s *SonarService) Gate(ctx context.Context, project string, scope SonarScope) (*SonarGate, error)
- func (s *SonarService) Get(ctx context.Context, project string, scope SonarScope) (*SonarProjectDetail, error)
- func (s *SonarService) Issues(ctx context.Context, params SonarIssuesParams) (*SonarIssueList, error)
- func (s *SonarService) List(ctx context.Context, params SonarListParams) (*SonarProjectList, error)
- type Stage
- type StartInput
- type StartResult
- type TaskRunInfo
Constants ¶
const ( StatusSucceeded = "Succeeded" StatusFailed = "Failed" StatusTimeout = "Timeout" StatusCancelled = "Cancelled" StatusRunning = "Running" )
const ( QualityGateTypeAutotests = "autotests" QualityGateTypeManual = "manual" )
const MaxBranchLength = 253
MaxBranchLength is the portal's bound on BuildInput.Branch.
Variables ¶
var ( ErrNotFound = errors.New("resource not found") ErrHTTPSRequired = errors.New("portal URL must use HTTPS") // ErrDeploymentNotFound is returned when a CDPipeline (deployment) // look-up fails. Wraps ErrNotFound so callers using errors.Is for // generic not-found handling still match. ErrDeploymentNotFound = fmt.Errorf("deployment %w", ErrNotFound) // ErrEnvNotFound is returned when a Stage (env) lookup within a known // deployment fails. Wraps ErrNotFound similarly. ErrEnvNotFound = fmt.Errorf("environment %w", ErrNotFound) // ErrPipelineNotFound is returned by `pipelinerun start` when the named // Tekton Pipeline does not exist. Wraps ErrNotFound for generic-not-found // handling. ErrPipelineNotFound = fmt.Errorf("pipeline %w", ErrNotFound) // ErrTriggerTemplateNotFound is returned by `pipelinerun start` when the // Pipeline carries a TriggerTemplate label but the named TriggerTemplate // does not exist. ErrTriggerTemplateNotFound = fmt.Errorf("trigger template %w", ErrNotFound) // ErrPlatformReject is returned when the platform rejects the start // request (e.g. missing required Pipeline param). ErrPlatformReject = errors.New("platform rejected request") // ErrPermissionDenied is returned for HTTP 403 from the portal. The // message must not leak resource metadata. ErrPermissionDenied = errors.New("permission denied") // ErrProjectNotFound is returned by `project build` when the named // Codebase does not exist. Wraps ErrNotFound for generic-not-found // handling. ErrProjectNotFound = fmt.Errorf("project %w", ErrNotFound) // ErrBranchNotFound is returned by `project build` when no CodebaseBranch // of the project carries the requested git branch. ErrBranchNotFound = fmt.Errorf("branch %w", ErrNotFound) // ErrBranchNotReady is returned by `project build` when the CodebaseBranch // status is not 'created'. ErrBranchNotReady = errors.New("branch not ready") // ErrBuildInProgress is returned by `project build` when a build run for // the branch is already active. Best effort: the check is list-then-create, // so two concurrent callers can both pass it. ErrBuildInProgress = errors.New("build already in progress") // ErrGitLabCIUnsupported is returned by `project build` for codebases whose // spec.ciTool is 'gitlab'; those builds are triggered through GitLab CI. ErrGitLabCIUnsupported = errors.New("GitLab CI builds are not supported") // ErrManagedParam is returned when --param targets a parameter the portal // derives from the project and branch (see BuildManagedParams). ErrManagedParam = errors.New("managed parameter cannot be overridden") // ErrPortalUnsupported is returned when the portal has no route for the // command at all (Fastify route-not-found): it predates the feature. ErrPortalUnsupported = errors.New("portal does not support this command") )
Sentinel errors for portal API failures.
var BuildManagedParams = []string{
"git-source-url",
"git-source-revision",
"targetBranch",
"CODEBASE_NAME",
"CODEBASEBRANCH_NAME",
"gitfullrepositoryname",
"changeNumber",
"patchsetNumber",
}
BuildManagedParams are the PipelineRun params the portal derives from the project and its branch; `--param` may not override them. Mirrors `x-krci-managed-params` in the vendored OpenAPI document.
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
func ValidateBuildParams ¶ added in v0.15.0
ValidateBuildParams rejects overrides of the params the portal derives from the project and its branch, before any network call. The server enforces the same set and reports reason=managed_param_override.
func VerifySession ¶ added in v0.16.0
func VerifySession(ctx context.Context, client *restapi.ClientWithResponses) error
VerifySession calls the authenticated /rest/v1/config endpoint through client, so the portal validates the client's bearer token. ErrUnauthorized means the portal rejected the token.
Types ¶
type AppCondition ¶ added in v0.16.0
type AppCondition struct {
Type string `json:"type"`
Message string `json:"message"`
LastTransitionTime *string `json:"lastTransitionTime"`
}
AppCondition is one entry of an Argo CD Application's status.conditions: the reason a comparison, sync, or health evaluation did not complete, such as an unreachable target cluster or a chart that fails to render.
type AppOperation ¶ added in v0.16.0
type AppOperation struct {
Phase string `json:"phase"`
Message *string `json:"message"`
StartedAt *string `json:"startedAt"`
FinishedAt *string `json:"finishedAt"`
}
AppOperation summarizes the last sync operation of an Argo CD Application (status.operationState). Phase is one of Argo CD's operation phases (Running, Succeeded, Failed, Error, Terminating).
type ArgoHealthStatus ¶ added in v0.12.0
type ArgoHealthStatus string
ArgoHealthStatus is one of ArgoCD's documented health-status values for an Application's `status.health.status` field. The CLI surfaces these in lowercase across `env get` and `project deployments`; renderers use the constants below to dispatch coloring without raw-string switches.
const ( ArgoHealthHealthy ArgoHealthStatus = "healthy" ArgoHealthDegraded ArgoHealthStatus = "degraded" ArgoHealthMissing ArgoHealthStatus = "missing" ArgoHealthProgressing ArgoHealthStatus = "progressing" ArgoHealthSuspended ArgoHealthStatus = "suspended" ArgoHealthUnknown ArgoHealthStatus = "unknown" )
type BuildInput ¶ added in v0.15.0
type BuildInput struct {
Codebase string // Codebase (project) name
Branch string // "" → server resolves codebase.spec.defaultBranch
Params map[string]string // non-managed parameter overrides (may be nil)
DryRun bool // true → render manifest without create
}
BuildInput is the `project build` request: the portal resolves the branch, build pipeline, params, labels and service account from the project itself.
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"`
DetailedMessage string `json:"detailedMessage,omitempty"`
Available bool `json:"available"`
}
Deployment represents a KubeRocketCI CDPipeline resource.
type DeploymentByProjectService ¶ added in v0.12.0
type DeploymentByProjectService struct {
// contains filtered or unexported fields
}
DeploymentByProjectService backs `krci project deployments <project>`. It fans out three concurrent k8s.list calls (Applications scoped to the project, Stages, CDPipelines) then joins them client-side.
func NewDeploymentByProjectService ¶ added in v0.12.0
func NewDeploymentByProjectService( client *restapi.ClientWithResponses, clusterName, namespace string, ) *DeploymentByProjectService
NewDeploymentByProjectService creates a service for the given cluster and namespace.
func (*DeploymentByProjectService) List ¶ added in v0.12.0
func (s *DeploymentByProjectService) List(ctx context.Context, project string) ([]ProjectDeploymentRow, error)
List returns one row per (deployment, env) pair where project is registered in the matching CDPipeline's spec.applications. Rows for stages without a matching Application carry deployed=false plus null dynamic fields (still surfacing static cluster/namespace/triggerType from the Stage so the user sees the full footprint). Stages and CDPipelines are fetched unscoped because the project-membership filter lives in CDPipeline.spec.applications, which has no equivalent label on Stage; the join is performed client-side.
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"`
DetailedMessage string `json:"detailedMessage,omitempty"`
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 EnvDetail ¶ added in v0.12.0
type EnvDetail struct {
Deployment string `json:"deployment"`
Env string `json:"env"`
Status string `json:"status"`
DetailedMessage *string `json:"detailedMessage"`
Description *string `json:"description"`
Order int `json:"order"`
Infrastructure Infrastructure `json:"infrastructure"`
QualityGates []QualityGateDetail `json:"qualityGates"`
Projects []EnvProject `json:"projects"`
}
EnvDetail is the response for `krci env get <deployment> <env>`. DetailedMessage is the Stage's status.detailed_message, null when the operator reported none.
type EnvListFilters ¶ added in v0.12.0
type EnvListFilters struct {
// Deployment is the parent CDPipeline name to filter by, or "" for all.
Deployment string
// Cluster is the post-mapping cluster filter, or "" for all.
Cluster string
}
EnvListFilters bounds an `env list` query.
type EnvListPayload ¶ added in v0.12.0
type EnvListPayload struct {
Stages []EnvSummary `json:"stages"`
}
EnvListPayload is the envelope `data` block for `krci env list`.
type EnvProject ¶ added in v0.12.0
type EnvProject struct {
Name string `json:"name"`
Status *string `json:"status"`
Sync *string `json:"sync"`
Version *string `json:"version"`
ImageTag *string `json:"imageTag"`
ImageDigest *string `json:"imageDigest"`
IngressURLs []string `json:"ingressUrls"`
ArgocdURL *string `json:"argocdUrl"`
DeployedAt *string `json:"deployedAt"`
ValuesOverride *bool `json:"valuesOverride"`
Conditions []AppCondition `json:"conditions"`
Operation *AppOperation `json:"operation"`
}
EnvProject is one row in EnvDetail.Projects. Conditions is always an array and Operation is null until the Application has been synced once.
type EnvService ¶ added in v0.12.0
type EnvService struct {
// contains filtered or unexported fields
}
EnvService surfaces KRCI Stages as user-facing "environments".
func NewEnvService ¶ added in v0.12.0
func NewEnvService(client *restapi.ClientWithResponses, clusterName, namespace string) *EnvService
NewEnvService creates an EnvService for the given cluster and namespace.
func (*EnvService) Get ¶ added in v0.12.0
Get returns the full detail of one stage. Fans out three k8s calls in parallel: list Stages (to resolve env-name → metadata.name), get parent CDPipeline (to enumerate registered apps), list Applications scoped to the (pipeline, stage) pair. The Application label `app.edp.epam.com/stage` carries `stage.spec.name` (the short identifier "dev"/"stage"/"prod"), not the compound resource name.
func (*EnvService) List ¶ added in v0.12.0
func (s *EnvService) List(ctx context.Context, f EnvListFilters) ([]EnvSummary, error)
List returns every KRCI Stage in the configured namespace, optionally filtered by parent deployment and/or cluster. The returned slice is always non-nil so callers can JSON-marshal it as `[]` rather than `null`.
type EnvSummary ¶ added in v0.12.0
type EnvSummary struct {
Deployment string `json:"deployment"`
Env string `json:"env"`
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
TriggerType string `json:"triggerType"`
Status string `json:"status"`
Order int `json:"order"`
}
EnvSummary is one row in `krci env list`. The JSON envelope emits this slice under the wire-key "stages" (see EnvListPayload.Stages) to match the upstream Stage K8s resource; the Go-side name "EnvSummary" reflects the CLI's user-facing "environment" abstraction.
type ImageVersion ¶ added in v0.16.0
type ImageVersion struct {
Name string `json:"name"`
Created string `json:"created"`
Digest string `json:"digest,omitempty"`
}
ImageVersion is one tag of a CodebaseImageStream: a version the build pipeline pushed for a branch, with its creation time and, when the registry reported one, the image digest.
type Infrastructure ¶ added in v0.12.0
type Infrastructure struct {
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
TriggerType string `json:"triggerType"`
DeployPipeline string `json:"deployPipeline"`
CleanPipeline *string `json:"cleanPipeline"`
}
Infrastructure carries the technical placement of an environment.
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"`
// Results maps the run's pipeline results (status.results) by name, e.g.
// VCS_TAG of a build. Only a run still in the cluster carries them: Tekton
// Results summaries do not.
Results map[string]any `json:"results,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, checking K8s first (the only source for in-flight runs) and falling back to Tekton Results for completed pipelines.
func (*PipelineRunService) List ¶ added in v0.4.0
func (s *PipelineRunService) List( ctx context.Context, opts PipelineRunListOptions, ) (*PipelineRunListResult, error)
List returns both running (from K8s) and completed (from Tekton Results) pipeline runs, merged and deduplicated. Same unified view as the portal UI.
func (*PipelineRunService) Wait ¶ added in v0.17.0
func (s *PipelineRunService) Wait( ctx context.Context, name string, opts PipelineRunGetOptions, interval time.Duration, ) (*PipelineRunListResult, error)
Wait polls the run every interval until it reaches a final status, then returns it with the expansion opts asks for. ctx bounds the wait.
type PipelineRunStartService ¶ added in v0.14.0
type PipelineRunStartService struct {
// contains filtered or unexported fields
}
func NewPipelineRunStartService ¶ added in v0.14.0
func NewPipelineRunStartService(client *restapi.ClientWithResponses, namespace string) *PipelineRunStartService
func (*PipelineRunStartService) Start ¶ added in v0.14.0
func (s *PipelineRunStartService) Start(ctx context.Context, in StartInput) (*StartResult, error)
Start calls `POST /rest/v1/pipelineruns/start`. Errors: startReasons by reason tag; a 404 without a reason is ErrPipelineNotFound; the rest per checkReasonedResponse.
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 ProjectBuildService ¶ added in v0.15.0
type ProjectBuildService struct {
// contains filtered or unexported fields
}
ProjectBuildService starts the build pipeline of a project branch, the way the portal's Build button does.
func NewProjectBuildService ¶ added in v0.15.0
func NewProjectBuildService(client *restapi.ClientWithResponses, namespace string) *ProjectBuildService
func (*ProjectBuildService) Build ¶ added in v0.15.0
func (s *ProjectBuildService) Build(ctx context.Context, in BuildInput) (*StartResult, error)
Build calls `POST /rest/v1/pipelineruns/build`. The 200 body is the same discriminated union `pipelinerun start` returns, so decoding is shared.
type ProjectDeploymentRow ¶ added in v0.12.0
type ProjectDeploymentRow struct {
Deployment string `json:"deployment"`
Env string `json:"env"`
Deployed bool `json:"deployed"`
Status *string `json:"status"`
Sync *string `json:"sync"`
Version *string `json:"version"`
ImageTag *string `json:"imageTag"`
ImageDigest *string `json:"imageDigest"`
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
TriggerType string `json:"triggerType"`
DeployedAt *string `json:"deployedAt"`
IngressURLs []string `json:"ingressUrls"`
ArgocdURL *string `json:"argocdUrl"`
Conditions []AppCondition `json:"conditions"`
Operation *AppOperation `json:"operation"`
}
ProjectDeploymentRow is one row in `krci project deployments <project>`. Conditions and Operation follow the EnvProject rules.
type ProjectDeploymentsPayload ¶ added in v0.12.0
type ProjectDeploymentsPayload struct {
Project string `json:"project"`
Rows []ProjectDeploymentRow `json:"rows"`
}
ProjectDeploymentsPayload is the envelope `data` block for `krci project deployments <project>`.
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 ProjectVersionStream ¶ added in v0.16.0
type ProjectVersionStream struct {
Branch string `json:"branch"`
Image string `json:"image"`
Versions []ImageVersion `json:"versions"`
}
ProjectVersionStream is one CodebaseImageStream of a project: the image repository of one git branch and its versions, newest first. Versions is always an array, empty for a branch that has never been built.
type ProjectVersionsPayload ¶ added in v0.16.0
type ProjectVersionsPayload struct {
Project string `json:"project"`
Streams []ProjectVersionStream `json:"streams"`
}
ProjectVersionsPayload is the envelope `data` block for `krci project versions <project>`.
type ProjectVersionsService ¶ added in v0.16.0
type ProjectVersionsService struct {
// contains filtered or unexported fields
}
ProjectVersionsService backs `krci project versions <project>`: the image versions the build pipeline pushed for each branch, read from the project's CodebaseImageStream resources.
func NewProjectVersionsService ¶ added in v0.16.0
func NewProjectVersionsService( client *restapi.ClientWithResponses, clusterName, namespace string, ) *ProjectVersionsService
NewProjectVersionsService creates a service for the given cluster and namespace.
func (*ProjectVersionsService) List ¶ added in v0.16.0
func (s *ProjectVersionsService) List(ctx context.Context, project, branch string) ([]ProjectVersionStream, error)
List returns one stream per CodebaseImageStream of project, sorted by git branch name, versions newest first. branch narrows the result to one git branch; "" returns every branch. Three concurrent calls: get the Codebase, so an unknown project fails instead of returning nothing; list the image streams by the codebase label; list the CodebaseBranches by the same label, which map a stream to its git branch name (a stream carries the branch resource name, e.g. my-app-release-2-27-781f0, not "release/2.27").
type QualityGate ¶ added in v0.3.0
QualityGate represents a quality gate step within a Stage.
type QualityGateDetail ¶ added in v0.12.0
type QualityGateDetail struct {
Type string `json:"type"`
StepName string `json:"stepName"`
AutotestName *string `json:"autotestName"`
BranchName *string `json:"branchName"`
}
QualityGateDetail extends QualityGate with autotest + branch metadata surfaced in `krci env get`.
type QualityGateStatus ¶ added in v0.8.0
type QualityGateStatus string
QualityGateStatus is the SonarQube quality-gate outcome. An unset gate (project never analyzed) maps to QualityGateNone.
const ( QualityGateOK QualityGateStatus = "OK" QualityGateWarn QualityGateStatus = "WARN" QualityGateError QualityGateStatus = "ERROR" QualityGateNone QualityGateStatus = "NONE" )
type SCAComponent ¶ added in v0.10.0
type SCAComponent struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Version string `json:"version"`
LatestVersion string `json:"latestVersion,omitempty"`
Outdated bool `json:"outdated,omitempty"`
Group string `json:"group,omitempty"`
License string `json:"license,omitempty"`
IsInternal bool `json:"isInternal,omitempty"`
RiskScore float32 `json:"riskScore,omitempty"`
Metrics *SCAMetrics `json:"metrics,omitempty"`
}
SCAComponent is one row in `krci sca components`.
type SCAComponentList ¶ added in v0.10.0
type SCAComponentList struct {
Status SCAStatus `json:"status"`
Items []SCAComponent `json:"items"`
TotalCount int `json:"totalCount"`
Truncated bool `json:"truncated"`
}
SCAComponentList is the response for `krci sca components <codebase>`. Truncated signals that items and totalCount reflect an incomplete view because the Portal could not examine every dependency before paginating.
type SCAComponentsParams ¶ added in v0.10.0
type SCAComponentsParams struct {
Codebase string
Branch string
Page int
PageSize int
OnlyOutdated bool
OnlyDirect bool
// Severity is the canonical upper-case Dep-Track severity set to filter by;
// empty slice means no filter. Applied server-side before the cap.
Severity []string
}
SCAComponentsParams carries the CLI-validated inputs for `krci sca components`.
type SCAFinding ¶ added in v0.10.0
type SCAFinding struct {
Component SCAFindingComponent `json:"component"`
Vulnerability SCAFindingVulnerability `json:"vulnerability"`
Analysis SCAFindingAnalysis `json:"analysis"`
Attribution SCAFindingAttribution `json:"attribution,omitempty"`
}
SCAFinding is one row in `krci sca findings`.
type SCAFindingAnalysis ¶ added in v0.10.0
type SCAFindingAnalysis struct {
State string `json:"state"`
IsSuppressed bool `json:"isSuppressed"`
}
SCAFindingAnalysis is the analysis side of one finding row.
type SCAFindingAttribution ¶ added in v0.10.0
type SCAFindingAttribution struct {
AnalyzerIdentity string `json:"analyzerIdentity,omitempty"`
AttributedOn int64 `json:"attributedOn,omitempty"`
}
SCAFindingAttribution is the attribution side of one finding row.
type SCAFindingComponent ¶ added in v0.10.0
type SCAFindingComponent struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Version string `json:"version,omitempty"`
Group string `json:"group,omitempty"`
}
SCAFindingComponent is the component side of one finding row.
type SCAFindingList ¶ added in v0.10.0
type SCAFindingList struct {
Status SCAStatus `json:"status"`
Items []SCAFinding `json:"items"`
Truncated bool `json:"truncated"`
}
SCAFindingList is the response for `krci sca findings <codebase>`.
type SCAFindingVulnerability ¶ added in v0.10.0
type SCAFindingVulnerability struct {
VulnID string `json:"vulnId"`
Source string `json:"source"`
Severity string `json:"severity"`
CvssV3BaseScore float32 `json:"cvssV3BaseScore,omitempty"`
CvssV2BaseScore float32 `json:"cvssV2BaseScore,omitempty"`
}
SCAFindingVulnerability is the vulnerability side of one finding row.
type SCAFindingsParams ¶ added in v0.10.0
type SCAFindingsParams struct {
Codebase string
Branch string
IncludeSuppressed bool
Source string
// Severity is the canonical upper-case Dep-Track severity set to filter by;
// empty slice means no filter. Applied server-side before the cap.
Severity []string
}
SCAFindingsParams carries the CLI-validated inputs for `krci sca findings`.
type SCAListParams ¶ added in v0.10.0
type SCAListParams struct {
Page int
PageSize int
Search string
IncludeInactive bool
IncludeChildren bool
}
SCAListParams carries the CLI-validated inputs for `krci sca list`.
type SCAMetrics ¶ added in v0.10.0
type SCAMetrics struct {
Critical int `json:"critical"`
High int `json:"high"`
Medium int `json:"medium"`
Low int `json:"low"`
Unassigned int `json:"unassigned"`
Vulnerabilities int `json:"vulnerabilities"`
Components int `json:"components,omitempty"`
VulnerableComponents int `json:"vulnerableComponents,omitempty"`
}
SCAMetrics carries the vulnerability-count rollup for a project or component.
type SCAProject ¶ added in v0.10.0
type SCAProject struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Version string `json:"version"`
Classifier string `json:"classifier,omitempty"`
Active bool `json:"active,omitempty"`
IsLatest bool `json:"isLatest,omitempty"`
LastBomImport int64 `json:"lastBomImport,omitempty"`
LastBomImportFormat string `json:"lastBomImportFormat,omitempty"`
LastVulnerabilityAnalysis int64 `json:"lastVulnerabilityAnalysis,omitempty"`
RiskScore float32 `json:"riskScore,omitempty"`
Metrics *SCAMetrics `json:"metrics,omitempty"`
}
SCAProject is one row in `krci sca list` / the `project` member of `krci sca get`.
type SCAProjectDetail ¶ added in v0.10.0
type SCAProjectDetail struct {
Status SCAStatus `json:"status"`
Project *SCAProject `json:"project,omitempty"`
Metrics *SCAMetrics `json:"metrics,omitempty"`
}
SCAProjectDetail is the response for `krci sca get <codebase>`. When Status is NONE, Project and Metrics are nil.
type SCAProjectList ¶ added in v0.10.0
type SCAProjectList struct {
Items []SCAProject `json:"items"`
TotalCount int `json:"totalCount"`
}
SCAProjectList is the response for `krci sca list`.
type SCAService ¶ added in v0.10.0
type SCAService struct {
// contains filtered or unexported fields
}
SCAService wraps the generated restapi ScaList/ScaGet/ScaComponents/ScaFindings methods and returns decoupled domain structs.
func NewSCAService ¶ added in v0.10.0
func NewSCAService(client *restapi.ClientWithResponses) *SCAService
NewSCAService creates an SCAService over the generated portal client.
func (*SCAService) Components ¶ added in v0.10.0
func (s *SCAService) Components(ctx context.Context, params SCAComponentsParams) (*SCAComponentList, error)
Components returns the paginated dependency list for a codebase/branch pair.
func (*SCAService) Findings ¶ added in v0.10.0
func (s *SCAService) Findings(ctx context.Context, params SCAFindingsParams) (*SCAFindingList, error)
Findings returns the vulnerability findings for a codebase/branch pair. The Portal caps the server-side result at 1000 rows; when exceeded, Truncated is true. Severity filter is applied server-side before the cap.
func (*SCAService) Get ¶ added in v0.10.0
func (s *SCAService) Get(ctx context.Context, codebase, branch string) (*SCAProjectDetail, error)
Get returns the Dep-Track project overview for a codebase/branch pair. When no project is bound for the pair, Status is SCAStatusNone and Project / Metrics are nil.
func (*SCAService) List ¶ added in v0.10.0
func (s *SCAService) List(ctx context.Context, params SCAListParams) (*SCAProjectList, error)
List returns the paginated Dep-Track project listing.
type SCAStatus ¶ added in v0.10.0
type SCAStatus string
SCAStatus is the Dep-Track binding state for a (codebase, branch) pair. OK means a Dep-Track project exists; NONE means the codebase has no Dep-Track project for the requested branch — clients emit an empty payload and exit 0 in that case.
type SonarGate ¶ added in v0.8.0
type SonarGate struct {
ProjectStatus SonarGateProjectStatus `json:"projectStatus"`
}
SonarGate is the response for `krci sonar gate <project>`.
type SonarGateCondition ¶ added in v0.8.0
type SonarGateCondition struct {
MetricKey string `json:"metricKey"`
Comparator string `json:"comparator,omitempty"`
ErrorThreshold string `json:"errorThreshold,omitempty"`
ActualValue string `json:"actualValue,omitempty"`
Status QualityGateStatus `json:"status"`
}
SonarGateCondition is one row in the gate conditions table.
type SonarGateProjectStatus ¶ added in v0.8.0
type SonarGateProjectStatus struct {
Status QualityGateStatus `json:"status"`
Conditions []SonarGateCondition `json:"conditions"`
IgnoredConditions bool `json:"ignoredConditions,omitempty"`
}
SonarGateProjectStatus carries the overall + per-condition gate state. `Conditions` is always serialized as `[]` (never null) so scripting consumers can always range over it.
type SonarIssue ¶ added in v0.8.0
type SonarIssue struct {
Key string `json:"key"`
Rule string `json:"rule"`
Severity string `json:"severity"`
Type string `json:"type"`
Status string `json:"status"`
Component string `json:"component"`
Project string `json:"project"`
Line int `json:"line,omitempty"`
Message string `json:"message"`
Effort string `json:"effort,omitempty"`
Debt string `json:"debt,omitempty"`
Author string `json:"author,omitempty"`
CreationDate string `json:"creationDate"`
UpdateDate string `json:"updateDate,omitempty"`
Tags []string `json:"tags,omitempty"`
}
SonarIssue is one row in `krci sonar issues <project>`.
type SonarIssueList ¶ added in v0.8.0
type SonarIssueList struct {
Paging SonarPaging `json:"paging"`
Issues []SonarIssue `json:"issues"`
}
SonarIssueList is the response for `krci sonar issues <project>`. SonarQube's raw response duplicates pagination via both `total`/`p`/`ps` and a `paging` object; we only surface the structured `Paging` form.
type SonarIssuesParams ¶ added in v0.8.0
type SonarIssuesParams struct {
ProjectKey string
PullRequest string
Branch string
Types []string
Severities []string
Statuses []string
Resolved *bool
Sort string
Asc *bool
Page int
PageSize int
}
SonarIssuesParams carries the CLI-validated inputs for `krci sonar issues`. Types / Severities / Statuses are the already-validated enum values; the service joins them with commas when building the restapi query string. Resolved and Asc are `*bool`: nil means "let SonarQube apply its default", non-nil forwards the explicit value. PullRequest / Branch follow the same mutex rule as SonarScope.
type SonarListParams ¶ added in v0.8.0
SonarListParams carries the CLI-validated inputs for `krci sonar list`.
type SonarPaging ¶ added in v0.8.0
type SonarPaging struct {
PageIndex int `json:"pageIndex"`
PageSize int `json:"pageSize"`
Total int `json:"total"`
}
SonarPaging is shared across paginated responses.
type SonarProject ¶ added in v0.8.0
type SonarProject struct {
Key string `json:"key"`
Name string `json:"name"`
Visibility string `json:"visibility,omitempty"`
LastAnalysisDate string `json:"lastAnalysisDate,omitempty"`
Revision string `json:"revision,omitempty"`
QualityGateStatus QualityGateStatus `json:"qualityGateStatus,omitempty"`
}
SonarProject is one entry in `krci sonar list`. `Qualifier` is an internal SonarQube discriminator (`TRK` for projects); we don't surface it. `Visibility` / `LastAnalysisDate` / `Revision` are best-effort optional fields — SonarQube's `/api/components/search` (the default non-admin endpoint) omits them, so they are typically absent.
type SonarProjectDetail ¶ added in v0.8.0
type SonarProjectDetail struct {
Key string `json:"key"`
Name string `json:"name"`
Visibility string `json:"visibility"`
LastAnalysisDate string `json:"lastAnalysisDate"`
Revision string `json:"revision"`
QualityGateStatus QualityGateStatus `json:"qualityGateStatus"`
Measures map[string]string `json:"measures"`
}
SonarProjectDetail is the response for `krci sonar get <project>`. All user-facing fields are always present (empty string when unknown) so downstream scripts can safely `jq .data.revision` without a `has` guard. `Qualifier` (SonarQube's internal `TRK` discriminator) is intentionally hidden.
type SonarProjectList ¶ added in v0.8.0
type SonarProjectList struct {
Projects []SonarProject `json:"projects"`
Paging SonarPaging `json:"paging"`
}
SonarProjectList is the response for `krci sonar list`.
type SonarScope ¶ added in v0.9.0
SonarScope narrows a Sonar query to a pull request OR a branch. The two fields are mutually exclusive at the SonarQube API layer; callers validate that invariant before handing the struct to the service.
type SonarService ¶ added in v0.8.0
type SonarService struct {
// contains filtered or unexported fields
}
SonarService wraps the generated restapi SonarList/SonarGet/SonarGate/SonarIssues methods and returns decoupled domain structs.
func NewSonarService ¶ added in v0.8.0
func NewSonarService(client *restapi.ClientWithResponses) *SonarService
NewSonarService creates a SonarService over the generated portal client.
func (*SonarService) Gate ¶ added in v0.8.0
func (s *SonarService) Gate(ctx context.Context, project string, scope SonarScope) (*SonarGate, error)
Gate calls `GET /rest/v1/sonar/gate`.
func (*SonarService) Get ¶ added in v0.8.0
func (s *SonarService) Get(ctx context.Context, project string, scope SonarScope) (*SonarProjectDetail, error)
Get calls `GET /rest/v1/sonar/get`. When a scope is supplied and upstream returns 404, the returned error message distinguishes between "pull request <id> not found" and "branch <name> not found".
func (*SonarService) Issues ¶ added in v0.8.0
func (s *SonarService) Issues(ctx context.Context, params SonarIssuesParams) (*SonarIssueList, error)
Issues calls `GET /rest/v1/sonar/issues`.
func (*SonarService) List ¶ added in v0.8.0
func (s *SonarService) List(ctx context.Context, params SonarListParams) (*SonarProjectList, error)
List calls `GET /rest/v1/sonar/list`.
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"`
DetailedMessage string `json:"detailedMessage,omitempty"`
Available bool `json:"available"`
}
Stage represents a KubeRocketCI Stage resource belonging to a CDPipeline. DetailedMessage carries the operator's status.detailed_message, the reason behind a failed status, and is omitted when the resource has none.
type StartInput ¶ added in v0.14.0
type StartResult ¶ added in v0.14.0
type StartResult struct {
Name string `json:"name"`
Status string `json:"status"`
Project string `json:"project"`
PR string `json:"pr"`
Author string `json:"author"`
Type string `json:"type"`
Started string `json:"started"`
Duration string `json:"duration"`
// DryRunManifest is the rendered PipelineRun resource emitted when
// DryRun=true; nil on the live-create path.
DryRunManifest map[string]any `json:"dryRunManifest,omitempty"`
}
StartResult is the row shape returned by `pipelinerun start`. Mirrors the `pipelinerun list` columns exactly so users pivot directly between the two verbs.