common

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ResourceTypeTaskRun is the string representation of a TaskRun resource
	ResourceTypeTaskRun = "taskrun"
	// ResourceTypePipelineRun is the string representation of a PipelineRun resource
	ResourceTypePipelineRun = "pipelinerun"
	// ListFields is the string used to fetch partial response
	//  for the list command in the API calls
	ListFields = "" /* 134-byte string literal not displayed */
	// NameUIDAndDataField is the string used to fetch name, UID and Data
	NameUIDAndDataField = "records.name,records.uid,records.data.value"
	// AllNamespacesResultsParent is the parent path used for listing results across all namespaces.
	AllNamespacesResultsParent = "-/results/-"
)

Variables

This section is empty.

Functions

func BuildConfigContextInfo added in v0.17.0

func BuildConfigContextInfo(context *api.Context) (configContextName, clusterName, userName string, err error)

BuildConfigContextInfo extracts cluster name, username, and constructs the config context name from a Kubernetes context.

Parameters:

  • context: The Kubernetes context object from kubeconfig

Returns:

  • configContextName: The config context name in format "tekton-results-config/{cluster}/{user}".
  • clusterName: The cluster name from the context.
  • userName: The extracted username (part before "/" if present).
  • error: An error if the context is missing cluster/user information.

func BuildFilterString

func BuildFilterString(opts FilterOptions) string

BuildFilterString constructs the filter string for the ListRecordsRequest

func FormatAge

func FormatAge(t *metav1.Time, c clockwork.Clock) string

FormatAge returns a human-readable string representation of how long ago a timestamp occurred. The output format varies based on duration: seconds (<1m), minutes (<1h), hours (<24h), or days.

func ValidateLabels

func ValidateLabels(labels string) error

ValidateLabels validates the format of the provided labels string. Labels should be in the format "key=value" or "key=value,key2=value2". Returns an error if the format is invalid.

Types

type FilterOptions

type FilterOptions interface {
	GetLabel() string
	GetResourceName() string
	GetPipelineRun() string
	GetResourceType() string
	GetUID() string
}

FilterOptions defines the interface for filter options

type Params

type Params interface {
	// SetKubeConfigPath uses the kubeconfig path to instantiate tekton
	// returned by Clientset function
	SetKubeConfigPath(string)
	KubeConfigPath() string

	// SetKubeContext extends the specificity of the above SetKubeConfigPath
	// by using a context other than the default context in the given kubeconfig
	SetKubeContext(string)
	KubeContext() string

	// SetNamespace can be used to store the namespace parameter that is needed
	// by most commands
	SetNamespace(string)
	Namespace() string

	// SetHost can be used to store the host parameter that is needed
	// by most commands
	SetHost(string)
	Host() string

	// SetToken can be used to store the token parameter that is needed
	// by most commands
	SetToken(string)
	Token() string

	// SetApiPath can be used to store the api-path parameter that is needed
	// by most commands
	SetAPIPath(string)
	APIPath() string

	// SetSkipTlsVerify can be used to store the api-path parameter that is needed
	// by most commands
	SetSkipTLSVerify(bool)
	SkipTLSVerify() bool

	// Client access method for dependency injection
	// Returns REST client - from which log/record clients are created
	SetRESTClient(client *client.RESTClient)
	RESTClient() *client.RESTClient
}

Params interface provides

type ResultsParams

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

ResultsParams holds configuration parameters for interacting with Kubernetes and API endpoints.

func (*ResultsParams) APIPath

func (p *ResultsParams) APIPath() string

APIPath returns the API path prefix.

func (*ResultsParams) Host

func (p *ResultsParams) Host() string

Host returns the API server host address.

func (*ResultsParams) KubeConfigPath

func (p *ResultsParams) KubeConfigPath() string

KubeConfigPath returns the path to the Kubernetes configuration file.

func (*ResultsParams) KubeContext

func (p *ResultsParams) KubeContext() string

KubeContext returns the Kubernetes context name.

func (*ResultsParams) Namespace

func (p *ResultsParams) Namespace() string

Namespace returns the current Kubernetes namespace.

func (*ResultsParams) RESTClient added in v0.17.0

func (p *ResultsParams) RESTClient() *client.RESTClient

RESTClient returns the injected REST client

func (*ResultsParams) SetAPIPath

func (p *ResultsParams) SetAPIPath(path string)

SetAPIPath sets the API path prefix.

Parameters:

  • path: The API path prefix to set.

func (*ResultsParams) SetHost

func (p *ResultsParams) SetHost(host string)

SetHost sets the API server host address.

Parameters:

  • host: The host address to set.

func (*ResultsParams) SetKubeConfigPath

func (p *ResultsParams) SetKubeConfigPath(path string)

SetKubeConfigPath sets the path to the Kubernetes configuration file.

Parameters:

  • path: The file path to the Kubernetes configuration.

func (*ResultsParams) SetKubeContext

func (p *ResultsParams) SetKubeContext(context string)

SetKubeContext sets the Kubernetes context name.

Parameters:

  • context: The name of the Kubernetes context to use.

func (*ResultsParams) SetNamespace

func (p *ResultsParams) SetNamespace(ns string)

SetNamespace sets the Kubernetes namespace.

Parameters:

  • ns: The namespace to set. If empty, the default namespace from kubeconfig will be used.

func (*ResultsParams) SetRESTClient added in v0.17.0

func (p *ResultsParams) SetRESTClient(client *client.RESTClient)

SetRESTClient injects a REST client

func (*ResultsParams) SetSkipTLSVerify

func (p *ResultsParams) SetSkipTLSVerify(skip bool)

SetSkipTLSVerify sets whether TLS verification should be skipped.

Parameters:

  • skip: Whether to skip TLS verification.

func (*ResultsParams) SetToken

func (p *ResultsParams) SetToken(token string)

SetToken sets the authentication token.

Parameters:

  • token: The authentication token to set.

func (*ResultsParams) SkipTLSVerify

func (p *ResultsParams) SkipTLSVerify() bool

SkipTLSVerify returns whether TLS verification should be skipped.

func (*ResultsParams) Token

func (p *ResultsParams) Token() string

Token returns the authentication token.

type Stream

type Stream struct {
	In  io.Reader
	Out io.Writer
	Err io.Writer
}

Stream for input and output

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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