portal

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 21 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

Index

Constants

View Source
const (
	PodPhaseRunning   = "Running"
	PodPhaseSucceeded = "Succeeded"
	PodPhaseFailed    = "Failed"
)

Pod phases of EnvPod.Phase that the status derivation and the table read.

View Source
const (
	ContainerWaiting    = "waiting"
	ContainerRunning    = "running"
	ContainerTerminated = "terminated"
)

Container states of PodContainer.State.

View Source
const (
	StatusSucceeded = "Succeeded"
	StatusFailed    = "Failed"
	StatusTimeout   = "Timeout"
	StatusCancelled = "Cancelled"
	StatusRunning   = "Running"
)
View Source
const (
	// TasksRunNotFinished: the run is pending or still running, and task data
	// is read from Tekton Results once it has finished.
	TasksRunNotFinished = "run_not_finished"
	// TasksNotIndexed: the run has finished and Tekton Results has no task
	// data for it yet.
	TasksNotIndexed = "not_indexed"
	// TasksNone: the run has finished and its Tekton Results record lists no
	// TaskRun; it never scheduled a task.
	TasksNone = "no_tasks"
)

Values of PipelineRunListResult.TasksUnavailable.

View Source
const (
	QualityGateTypeAutotests = "autotests"
	QualityGateTypeManual    = "manual"
)
View Source
const EventTypeWarning = "Warning"

EventTypeWarning is the Kubernetes event type `env events --warnings` keeps.

View Source
const MaxBranchLength = 253

MaxBranchLength is the portal's bound on BuildInput.Branch.

View Source
const PodProjectLabel = "app.kubernetes.io/instance"

PodProjectLabel is the pod label the Portal reads to find the pods of one application. The platform installs a project as a Helm release named after it, and the chart it scaffolds for a project sets the label to the release name.

Variables

View Source
var (
	ErrUnauthorized        = errors.New("unauthorized: please run 'krci auth login'")
	ErrNotFound            = errors.New("resource not found")
	ErrInvalidPortalURL    = errors.New("invalid portal URL")
	ErrUpstreamUnavailable = errors.New("upstream service unavailable")

	// ErrRedirectRefused is returned when a portal response redirects to
	// another host or port, or from https to http.
	ErrRedirectRefused = errors.New("redirect refused")

	// ErrUnexpectedResponse is returned when the portal answers 200 with a
	// Content-Type that is not JSON, e.g. a web page from a proxy or the SPA
	// fallback.
	ErrUnexpectedResponse = errors.New("unexpected portal response")

	// ErrResponseTooLarge is returned when a portal response body exceeds
	// the read cap.
	ErrResponseTooLarge = errors.New("portal response too large")

	// 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)

	// ErrRemoteCluster is returned by `env pods` and `env events` for an
	// environment on a cluster other than the one the Portal runs on.
	ErrRemoteCluster = errors.New("environment runs on another cluster")

	// 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.

View Source
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

func FetchOIDCConfig(ctx context.Context, 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. portalURL must pass ValidatePortalURL.

func IsFailureStatus added in v0.5.0

func IsFailureStatus(status string) bool

func NewRestClient added in v0.20.0

func NewRestClient(
	baseURL string, timeout time.Duration, opts ...restapi.ClientOption,
) (*restapi.ClientWithResponses, error)

NewRestClient returns the generated portal client sending through a doer: requests time out after timeout, bodies are capped at maxResponseBodyBytes. The doer replaces any HTTP client in opts.

func PipelineRunStatusKeywords added in v0.19.0

func PipelineRunStatusKeywords() []string

PipelineRunStatusKeywords returns the keywords the status filter accepts.

func ValidateBuildParams added in v0.15.0

func ValidateBuildParams(params map[string]string) error

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 ValidatePipelineRunStatus added in v0.19.0

func ValidatePipelineRunStatus(name, keyword string) error

ValidatePipelineRunStatus rejects a status filter keyword that is not one of PipelineRunStatusKeywords; case is ignored. name is how the error refers to the value, such as the flag that carries it.

func ValidatePortalURL added in v0.20.0

func ValidatePortalURL(raw string) error

ValidatePortalURL accepts an absolute URL with a host, no user info, no query and no fragment, whose scheme is https, or http when the host is localhost or a loopback IP. A path is allowed. Failure wraps ErrInvalidPortalURL. The message carries the URL, password redacted, only when it parsed with a host and has no query or fragment.

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(ctx context.Context, portalURL, token string) (*ClusterConfig, error)

FetchClusterConfig calls the authenticated /rest/v1/config endpoint and returns cluster name and default namespace. portalURL must pass ValidatePortalURL.

type ContainerTermination added in v0.20.0

type ContainerTermination struct {
	Reason     *string `json:"reason"`
	Message    *string `json:"message"`
	ExitCode   int     `json:"exitCode"`
	StartedAt  *string `json:"startedAt"`
	FinishedAt *string `json:"finishedAt"`
}

ContainerTermination is how the previous run of a container ended.

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

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

Get returns a single CDPipeline with its Stages sorted by order. A CDPipeline error is reported before a Stage list error.

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 EnvEvent added in v0.20.0

type EnvEvent struct {
	Type           string      `json:"type"`
	Reason         string      `json:"reason"`
	Message        string      `json:"message"`
	InvolvedObject EventObject `json:"involvedObject"`
	Count          int         `json:"count"`
	FirstSeen      *string     `json:"firstSeen"`
	LastSeen       *string     `json:"lastSeen"`
	Source         *string     `json:"source"`
}

EnvEvent is one Kubernetes event. Count, FirstSeen and LastSeen are the values `kubectl get events` derives: an event recorded as a series reports the series count and its last observed time.

type EnvEventFilters added in v0.20.0

type EnvEventFilters struct {
	// Pod keeps the events about the pod of this name, or "" for every object.
	Pod string
	// WarningsOnly keeps the events of type EventTypeWarning.
	WarningsOnly bool
}

EnvEventFilters narrows an `env events` query.

type EnvEventsPayload added in v0.20.0

type EnvEventsPayload struct {
	EnvNamespace
	Events []EnvEvent `json:"events"`
}

EnvEventsPayload is the envelope `data` block for `krci env events <deployment> <env>`: the Kubernetes events of the environment namespace, newest first.

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 EnvNamespace added in v0.20.0

type EnvNamespace struct {
	Deployment string `json:"deployment"`
	Env        string `json:"env"`
	Cluster    string `json:"cluster"`
	Namespace  string `json:"namespace"`
}

EnvNamespace names the namespace `krci env pods` and `krci env events` read: the environment and where its Stage places it.

type EnvPod added in v0.20.0

type EnvPod struct {
	Name            string         `json:"name"`
	Project         *string        `json:"project"`
	Status          string         `json:"status"`
	Phase           string         `json:"phase"`
	ReadyContainers int            `json:"readyContainers"`
	TotalContainers int            `json:"totalContainers"`
	Restarts        int            `json:"restarts"`
	LastRestartAt   *string        `json:"lastRestartAt"`
	CreatedAt       *string        `json:"createdAt"`
	Node            *string        `json:"node"`
	Owner           *PodOwner      `json:"owner"`
	Reason          *string        `json:"reason"`
	Message         *string        `json:"message"`
	Conditions      []PodCondition `json:"conditions"`
	Containers      []PodContainer `json:"containers"`
}

EnvPod is one pod of an environment namespace. Status, ReadyContainers, TotalContainers and Restarts are the STATUS, READY and RESTARTS values `kubectl get pods` prints for the pod. Project is the project registered in the deployment whose name the pod carries in PodProjectLabel, null for any other pod. LastRestartAt is the time of the newest restart Restarts counts, null without one. Reason and Message are the pod's own status.reason and status.message (Evicted, NodeLost), null when the pod sets none.

func (EnvPod) Healthy added in v0.20.0

func (p EnvPod) Healthy() bool

Healthy reports whether the pod has completed, or runs with every container ready and a Status equal to its Phase.

type EnvPodsPayload added in v0.20.0

type EnvPodsPayload struct {
	EnvNamespace
	Pods []EnvPod `json:"pods"`
}

EnvPodsPayload is the envelope `data` block for `krci env pods <deployment> <env>`: the pods of the environment namespace, sorted by name.

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) Events added in v0.20.0

func (s *EnvService) Events(
	ctx context.Context, deployment, env string, f EnvEventFilters,
) (*EnvEventsPayload, error)

Events returns the Kubernetes events in the namespace of one environment that pass the filters, newest first. A missing deployment or environment is answered like Get, an environment on another cluster with ErrRemoteCluster.

func (*EnvService) Get added in v0.12.0

func (s *EnvService) Get(ctx context.Context, deployment, env string) (*EnvDetail, error)

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. The error order is the resolveTarget error, ErrEnvNotFound, then the Applications list error.

func (*EnvService) List added in v0.12.0

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`.

func (*EnvService) Pods added in v0.20.0

func (s *EnvService) Pods(ctx context.Context, deployment, env string) (*EnvPodsPayload, error)

Pods returns the pods in the namespace of one environment. A missing deployment or environment is answered like Get, an environment on another cluster with ErrRemoteCluster.

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 EventObject added in v0.20.0

type EventObject struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

EventObject is the object an event is about.

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 Option added in v0.20.0

type Option func(*options)

Option configures service constructors.

func WithNow added in v0.20.0

func WithNow(now func() time.Time) Option

WithNow sets the clock that measures the duration of runs still in progress. Default: time.Now. now must be non-nil.

type PipelineRunFilter added in v0.4.0

type PipelineRunFilter struct {
	Project    string
	PRNumber   int
	Author     string
	Branch     string
	Type       string
	Status     string
	Deployment string
	Env        string
}

PipelineRunFilter holds composable filter criteria for listing pipeline runs. Deployment and Env select the deploy and clean runs of a CDPipeline stage. Env is honoured only together with Deployment.

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"`
	Deployment   string `json:"deployment,omitempty"`
	Env          string `json:"env,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"`
	// TasksUnavailable is the reason a --reason result carries no Tasks.
	TasksUnavailable string `json:"tasksUnavailable,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, opts ...Option,
) *PipelineRunService

NewPipelineRunService creates a PipelineRunService.

func (*PipelineRunService) Get added in v0.4.0

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

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

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

Start calls `POST /rest/v1/pipelineruns/start`. Errors: startReasons by reason tag; a 404 without a reason is ErrPipelineNotFound; the rest per checkReasonedResponse.

type PodCondition added in v0.20.0

type PodCondition struct {
	Type               string  `json:"type"`
	Status             string  `json:"status"`
	Reason             *string `json:"reason"`
	Message            *string `json:"message"`
	LastTransitionTime *string `json:"lastTransitionTime"`
}

PodCondition is one pod condition that holds the pod back: a condition that is not True, or a DisruptionTarget that is.

type PodContainer added in v0.20.0

type PodContainer struct {
	Name            string                `json:"name"`
	Init            bool                  `json:"init"`
	Sidecar         bool                  `json:"sidecar"`
	Image           string                `json:"image"`
	ImageID         *string               `json:"imageID"`
	ImageDigest     *string               `json:"imageDigest"`
	Ready           bool                  `json:"ready"`
	Restarts        int                   `json:"restarts"`
	State           string                `json:"state"`
	Reason          *string               `json:"reason"`
	Message         *string               `json:"message"`
	ExitCode        *int                  `json:"exitCode"`
	StartedAt       *string               `json:"startedAt"`
	FinishedAt      *string               `json:"finishedAt"`
	LastTermination *ContainerTermination `json:"lastTermination"`
}

PodContainer is one container the kubelet reported for a pod, init containers first. Image is the image the pod spec asks for. ImageID is the status imageID the runtime reports, null until the image is present. ImageDigest is the registry digest in ImageID, null when ImageID names none: a bare "sha256:<hex>" is the image's local ID, not its registry digest. Reason and Message belong to a waiting or terminated State, ExitCode and FinishedAt to a terminated one, StartedAt to a running or terminated one. LastTermination is the previous run of a restarted container. Sidecar marks an init container that restarts always: it runs beside the containers and READY counts it.

func (PodContainer) FailsReadiness added in v0.20.0

func (c PodContainer) FailsReadiness() bool

FailsReadiness reports whether a running container or sidecar is not ready. A regular init container is not ready while it runs.

func (PodContainer) NeedsAttention added in v0.20.0

func (c PodContainer) NeedsAttention() bool

NeedsAttention reports whether the container has been restarted, or is neither running ready nor terminated with exit code 0.

type PodOwner added in v0.20.0

type PodOwner struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

PodOwner is the owner of a pod: its controller (a ReplicaSet for a Deployment, a StatefulSet, a DaemonSet, a Job), or its first owner when none is marked as the controller.

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

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.

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 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"). The error order is the Codebase get, the image stream list, then the branch list.

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

const (
	SCAStatusOK   SCAStatus = "OK"
	SCAStatusNone SCAStatus = "NONE"
)

type Services added in v0.20.0

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

Services builds the portal services of one Target over one client.

func NewServices added in v0.20.0

func NewServices(client *restapi.ClientWithResponses, target Target, opts ...Option) *Services

NewServices returns the services of target over client. target is not validated.

func (*Services) Deployment added in v0.20.0

func (s *Services) Deployment() *DeploymentService

Deployment returns the deployment service of the target.

func (*Services) DeploymentByProject added in v0.20.0

func (s *Services) DeploymentByProject() *DeploymentByProjectService

DeploymentByProject returns the per-project deployments service of the target.

func (*Services) Env added in v0.20.0

func (s *Services) Env() *EnvService

Env returns the environment service of the target.

func (*Services) PipelineRun added in v0.20.0

func (s *Services) PipelineRun() *PipelineRunService

PipelineRun returns the pipeline run service of the target. It measures running-run durations on the clock set by WithNow (default time.Now).

func (*Services) PipelineRunStart added in v0.20.0

func (s *Services) PipelineRunStart() *PipelineRunStartService

PipelineRunStart returns the pipeline run start service of the target.

func (*Services) Project added in v0.20.0

func (s *Services) Project() *ProjectService

Project returns the project service of the target.

func (*Services) ProjectBuild added in v0.20.0

func (s *Services) ProjectBuild() *ProjectBuildService

ProjectBuild returns the project build service of the target.

func (*Services) ProjectVersions added in v0.20.0

func (s *Services) ProjectVersions() *ProjectVersionsService

ProjectVersions returns the project versions service of the target.

func (*Services) SCA added in v0.20.0

func (s *Services) SCA() *SCAService

SCA returns the Dependency-Track service.

func (*Services) Sonar added in v0.20.0

func (s *Services) Sonar() *SonarService

Sonar returns the SonarQube service.

func (*Services) VerifySession added in v0.20.0

func (s *Services) VerifySession(ctx context.Context) error

VerifySession calls the authenticated /rest/v1/config endpoint, so the portal validates the client's bearer token. ErrUnauthorized means the portal rejected the token. A 200 is accepted only when its body is the cluster config (see readClusterConfig).

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

type SonarListParams struct {
	Page       int
	PageSize   int
	SearchTerm string
}

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

type SonarScope struct {
	PullRequest string
	Branch      string
}

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

Issues calls `GET /rest/v1/sonar/issues`.

func (*SonarService) List added in v0.8.0

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 StartInput struct {
	Pipeline string            // Kubernetes name of the Tekton Pipeline
	Params   map[string]string // user-supplied parameter overrides (may be nil)
	Labels   map[string]string // labels to attach to metadata.labels (may be nil)
	DryRun   bool              // true → render manifest without create
}

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.

type Target added in v0.20.0

type Target struct {
	PortalURL string
	Cluster   string
	Namespace string
}

Target is the portal, cluster and namespace that services talk to.

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