utils

package
v0.0.0-...-7fab577 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Param

type Param struct {
	// Name is the name of the parameter
	Name string `json:"name"`

	// Value is the value of the parameter
	Value string `json:"value"`
}

Param defines the parameters for a given resolver in PipelineRef

type ParameterizedPipeline

type ParameterizedPipeline struct {
	Pipeline
	Params []Param `json:"params,omitempty"`
}

ParameterizedPipeline is an extension of the Pipeline struct, adding an array of parameters that will be passed to the Pipeline. +kubebuilder:object:generate=true

func (*ParameterizedPipeline) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParameterizedPipeline.

func (*ParameterizedPipeline) DeepCopyInto

func (in *ParameterizedPipeline) DeepCopyInto(out *ParameterizedPipeline)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Pipeline

type Pipeline struct {
	// PipelineRef is the reference to the Pipeline
	PipelineRef PipelineRef `json:"pipelineRef"`

	// ServiceAccount is the ServiceAccount to use during the execution of the Pipeline
	// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
	// +optional
	ServiceAccount string `json:"serviceAccountName,omitempty"`

	// Timeouts defines the different Timeouts to use in the PipelineRun execution
	// +optional
	Timeouts tektonv1.TimeoutFields `json:"timeouts,omitempty"`
}

Pipeline contains a reference to a Pipeline and the name of the service account to use while executing it. +kubebuilder:object:generate=true

func (*Pipeline) DeepCopy

func (in *Pipeline) DeepCopy() *Pipeline

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pipeline.

func (*Pipeline) DeepCopyInto

func (in *Pipeline) DeepCopyInto(out *Pipeline)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PipelineRef

type PipelineRef struct {
	// Resolver is the name of a Tekton resolver to be used (e.g. git)
	Resolver string `json:"resolver"`

	// Params is a slice of parameters for a given resolver
	Params []Param `json:"params"`
}

PipelineRef represents a reference to a Pipeline using a resolver. +kubebuilder:object:generate=true

func (*PipelineRef) DeepCopy

func (in *PipelineRef) DeepCopy() *PipelineRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRef.

func (*PipelineRef) DeepCopyInto

func (in *PipelineRef) DeepCopyInto(out *PipelineRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PipelineRef) IsClusterScoped

func (pr *PipelineRef) IsClusterScoped() bool

IsClusterScoped returns whether the PipelineRef uses a cluster resolver or not.

func (*PipelineRef) ToTektonPipelineRef

func (pr *PipelineRef) ToTektonPipelineRef() *tektonv1.PipelineRef

ToTektonPipelineRef converts a PipelineRef object to Tekton's own PipelineRef type and returns it.

type PipelineRunBuilder

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

func NewPipelineRunBuilder

func NewPipelineRunBuilder(namePrefix, namespace string) *PipelineRunBuilder

NewPipelineRunBuilder initializes a new PipelineRunBuilder with the given name prefix and namespace. It sets the name of the PipelineRun to be generated with the provided prefix and sets its namespace.

func (*PipelineRunBuilder) Build

Build returns the constructed PipelineRun and any accumulated error.

func (*PipelineRunBuilder) WithAnnotations

func (b *PipelineRunBuilder) WithAnnotations(annotations map[string]string) *PipelineRunBuilder

WithAnnotations appends or updates annotations to the PipelineRun's metadata. If the PipelineRun does not have existing annotations, it initializes them before adding.

func (*PipelineRunBuilder) WithFinalizer

func (b *PipelineRunBuilder) WithFinalizer(finalizer string) *PipelineRunBuilder

WithFinalizer adds the given finalizer to the PipelineRun's metadata.

func (*PipelineRunBuilder) WithLabels

func (b *PipelineRunBuilder) WithLabels(labels map[string]string) *PipelineRunBuilder

WithLabels appends or updates labels to the PipelineRun's metadata. If the PipelineRun does not have existing labels, it initializes them before adding.

func (*PipelineRunBuilder) WithObjectReferences

func (b *PipelineRunBuilder) WithObjectReferences(objects ...client.Object) *PipelineRunBuilder

WithObjectReferences constructs tektonv1.Param entries for each of the provided client.Objects. Each param name is derived from the object's Kind (with the first letter made lowercase) and the value is a combination of the object's Namespace and Name.

func (*PipelineRunBuilder) WithObjectSpecsAsJson

func (b *PipelineRunBuilder) WithObjectSpecsAsJson(objects ...client.Object) *PipelineRunBuilder

WithObjectSpecsAsJson constructs tektonv1.Param entries for the Spec field of each of the provided client.Objects. Each param name is derived from the object's Kind (with the first letter made lowercase). The value for each param is the JSON representation of the object's Spec. If an error occurs during extraction or serialization, it's accumulated in the builder's err field using multierror.

func (*PipelineRunBuilder) WithOwner

func (b *PipelineRunBuilder) WithOwner(object client.Object) *PipelineRunBuilder

WithOwner sets the given client.Object as the owner of the PipelineRun. It also adds the ReleaseFinalizer to the PipelineRun.

func (*PipelineRunBuilder) WithParams

func (b *PipelineRunBuilder) WithParams(params ...tektonv1.Param) *PipelineRunBuilder

WithParams appends the provided params to the PipelineRun's spec.

func (*PipelineRunBuilder) WithParamsFromConfigMap

func (b *PipelineRunBuilder) WithParamsFromConfigMap(configMap *corev1.ConfigMap, keys []string) *PipelineRunBuilder

WithParamsFromConfigMap adds parameters to the PipelineRun based on the provided keys from a given ConfigMap. If a key is present in the ConfigMap, a new tektonv1.Param is constructed with the key as the name and the associated value from the ConfigMap. Keys not found in the ConfigMap are ignored.

func (*PipelineRunBuilder) WithPipelineRef

func (b *PipelineRunBuilder) WithPipelineRef(pipelineRef *tektonv1.PipelineRef) *PipelineRunBuilder

WithPipelineRef sets the PipelineRef for the PipelineRun's spec.

func (*PipelineRunBuilder) WithServiceAccount

func (b *PipelineRunBuilder) WithServiceAccount(serviceAccount string) *PipelineRunBuilder

WithServiceAccount sets the ServiceAccountName for the PipelineRun's TaskRunTemplate.

func (*PipelineRunBuilder) WithTimeouts

func (b *PipelineRunBuilder) WithTimeouts(timeouts, defaultTimeouts *tektonv1.TimeoutFields) *PipelineRunBuilder

WithTimeouts sets the Timeouts for the PipelineRun.

func (*PipelineRunBuilder) WithWorkspaceFromVolumeTemplate

func (b *PipelineRunBuilder) WithWorkspaceFromVolumeTemplate(name, size string) *PipelineRunBuilder

WithWorkspaceFromVolumeTemplate creates and adds a workspace binding to the PipelineRun's spec using the provided workspace name and volume size.

Jump to

Keyboard shortcuts

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