tekton

package
v0.0.0-...-8139a23 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PipelinesLabelPrefix is the prefix of the pipelines label
	PipelinesLabelPrefix = "pipelines.appstudio.openshift.io"

	// TestLabelPrefix is the prefix of the test labels
	TestLabelPrefix = "test.appstudio.openshift.io"

	// resource labels for snapshot, application and component
	ResourceLabelSuffix = "appstudio.openshift.io"

	// PipelineTypeTest is the type for PipelineRuns created to run an integration Pipeline
	PipelineTypeTest = "test"
)
View Source
const (
	// PipelineRunTypeLabel contains the type of the PipelineRunTypeLabel.
	PipelineRunTypeLabel = "pipelines.appstudio.openshift.io/type"

	// PipelineRunBuildType is the type denoting a build PipelineRun.
	PipelineRunBuildType = "build"

	// PipelineRunTestType is the type denoting a test PipelineRun.
	PipelineRunTestType = "test"

	// PipelineRunComponentLabel is the label denoting the application.
	PipelineRunComponentLabel = "appstudio.openshift.io/component"

	// PipelineRunApplicationLabel is the label denoting the application.
	PipelineRunApplicationLabel = "appstudio.openshift.io/application"

	// PipelineRunChainsSignedAnnotation is the label added by Tekton Chains to signed PipelineRuns
	PipelineRunChainsSignedAnnotation = "chains.tekton.dev/signed"

	// PipelineRunImageUrlParamName name of image url output param
	PipelineRunImageUrlParamName = "IMAGE_URL"

	// PipelineRunImageDigestParamName name of image digest in PipelineRun result param
	PipelineRunImageDigestParamName = "IMAGE_DIGEST"

	// PipelineRunChainsGitUrlParamName name of param chains repo url
	PipelineRunChainsGitUrlParamName = "CHAINS-GIT_URL"

	// PipelineRunChainsGitCommitParamName name of param repo chains commit
	PipelineRunChainsGitCommitParamName = "CHAINS-GIT_COMMIT"
)

Variables

View Source
var (
	// PipelinesTypeLabel is the label used to describe the type of pipeline
	PipelinesTypeLabel = fmt.Sprintf("%s/%s", PipelinesLabelPrefix, "type")

	// TestNameLabel is the label used to specify the name of the Test associated with the PipelineRun
	TestNameLabel = fmt.Sprintf("%s/%s", TestLabelPrefix, "name")

	// ScenarioNameLabel is the label used to specify the name of the IntegrationTestScenario associated with the PipelineRun
	ScenarioNameLabel = fmt.Sprintf("%s/%s", TestLabelPrefix, "scenario")

	// SnapshotNameLabel is the label of specific the name of the snapshot associated with PipelineRun
	SnapshotNameLabel = fmt.Sprintf("%s/%s", ResourceLabelSuffix, "snapshot")

	// EnvironmentNameLabel is the label of specific the name of the environment associated with PipelineRun
	EnvironmentNameLabel = fmt.Sprintf("%s/%s", ResourceLabelSuffix, "environment")

	// ApplicationNameLabel is the label of specific the name of the Application associated with PipelineRun
	ApplicationNameLabel = fmt.Sprintf("%s/%s", ResourceLabelSuffix, "application")

	// ComponentNameLabel is the label of specific the name of the component associated with PipelineRun
	ComponentNameLabel = fmt.Sprintf("%s/%s", ResourceLabelSuffix, "component")

	// OptionalLabel is the label used to specify if an IntegrationTestScenario is allowed to fail
	OptionalLabel = fmt.Sprintf("%s/%s", TestLabelPrefix, "optional")
)

Functions

func AnnotateBuildPipelineRun

func AnnotateBuildPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, key, value string, cl client.Client) error

AnnotateBuildPipelineRun sets annotation for a build pipelineRun in defined context and returns that pipeline

func AnnotateBuildPipelineRunWithCreateSnapshotAnnotation

func AnnotateBuildPipelineRunWithCreateSnapshotAnnotation(ctx context.Context, pipelineRun *tektonv1.PipelineRun, cl client.Client, ensureSnapshotExistsErr error) error

AnnotateBuildPipelineRunWithCreateSnapshotAnnotation sets annotation test.appstudio.openshift.io/create-snapshot-status to build pipelineRun with a message that reflects either success or failure for creating a snapshot

func BuildPipelineRunCreatedPredicate

func BuildPipelineRunCreatedPredicate() predicate.Predicate

BuildPipelineRunCreatedPredicate returns a predicate which filters out all objects except Build PipelineRuns which have been created

func BuildPipelineRunDeletingPredicate

func BuildPipelineRunDeletingPredicate() predicate.Predicate

BuildPipelineRunDeletingPredicate returns a predicate which filters out all objects except Build PipelineRuns which have been updated to deleting

func BuildPipelineRunFailedPredicate

func BuildPipelineRunFailedPredicate() predicate.Predicate

BuildPipelineRunFailedPredicate returns a predicate which filters out all objects except Build PipelineRuns which have finished and have failed.

func BuildPipelineRunSignedAndSucceededPredicate

func BuildPipelineRunSignedAndSucceededPredicate() predicate.Predicate

BuildPipelineRunSignedAndSucceededPredicate returns a predicate which filters out all objects except Build PipelineRuns which have finished, been signed and haven't had a Snapshot created for them.

func GetComponentSourceGitCommit

func GetComponentSourceGitCommit(object client.Object) (string, error)

GetComponentSourceGitCommit returns a string containing the CHAINS-GIT_COMMIT result value from a given PipelineRun.

func GetComponentSourceGitUrl

func GetComponentSourceGitUrl(object client.Object) (string, error)

GetComponentSourceGitUrl returns a string containing the CHAINS-GIT_URL result value from a given PipelineRun.

func GetOutputImage

func GetOutputImage(object client.Object) (string, error)

GetOutputImage returns a string containing the output-image parameter value from a given PipelineRun.

func GetOutputImageDigest

func GetOutputImageDigest(object client.Object) (string, error)

GetOutputImageDigest returns a string containing the IMAGE_DIGEST result value from a given PipelineRun.

func GetTypeFromPipelineRun

func GetTypeFromPipelineRun(object client.Object) (string, error)

GetTypeFromPipelineRun extracts the pipeline type from the pipelineRun labels.

func IntegrationPipelineRunPredicate

func IntegrationPipelineRunPredicate() predicate.Predicate

IntegrationPipelineRunPredicate returns a predicate which filters out all objects except integration PipelineRuns that have just started or finished.

func IsBuildPipelineRun

func IsBuildPipelineRun(object client.Object) bool

IsBuildPipelineRun returns a boolean indicating whether the object passed is a PipelineRun from the Build service or not.

func IsIntegrationPipelineRun

func IsIntegrationPipelineRun(object client.Object) bool

IsIntegrationPipelineRun returns a boolean indicating whether the object passed is an Integration Component PipelineRun

Types

type IntegrationPipelineRun

type IntegrationPipelineRun struct {
	tektonv1.PipelineRun
}

IntegrationPipelineRun is a PipelineRun alias, so we can add new methods to it in this file.

func NewIntegrationPipelineRun

func NewIntegrationPipelineRun(prefix, namespace string, integrationTestScenario v1beta2.IntegrationTestScenario) *IntegrationPipelineRun

NewIntegrationPipelineRun creates an empty PipelineRun in the given namespace. The name will be autogenerated, using the prefix passed as an argument to the function.

func (*IntegrationPipelineRun) AsPipelineRun

func (r *IntegrationPipelineRun) AsPipelineRun() *tektonv1.PipelineRun

AsPipelineRun casts the IntegrationPipelineRun to PipelineRun, so it can be used in the Kubernetes client.

func (*IntegrationPipelineRun) WithApplicationAndComponent

func (r *IntegrationPipelineRun) WithApplicationAndComponent(application *applicationapiv1alpha1.Application, component *applicationapiv1alpha1.Component) *IntegrationPipelineRun

WithApplicationAndComponent adds the name of both application and component as lables to the Integration PipelineRun.

func (*IntegrationPipelineRun) WithEnvironmentAndDeploymentTarget

func (r *IntegrationPipelineRun) WithEnvironmentAndDeploymentTarget(dt *applicationapiv1alpha1.DeploymentTarget, environmentName string) *IntegrationPipelineRun

WithEnvironmentAndDeploymentTarget adds a param containing the DeploymentTarget connection details and Environment name to the integration PipelineRun.

func (*IntegrationPipelineRun) WithExtraParam

WithExtraParam adds an extra param to the Integration PipelineRun. If the parameter is not part of the Pipeline definition, it will be silently ignored.

func (*IntegrationPipelineRun) WithExtraParams

WithExtraParams adds all provided parameters to the Integration PipelineRun.

func (*IntegrationPipelineRun) WithFinalizer

func (iplr *IntegrationPipelineRun) WithFinalizer(finalizer string) *IntegrationPipelineRun

WithFinalizer adds a Finalizer on the Integration PipelineRun

func (*IntegrationPipelineRun) WithIntegrationAnnotations

WithIntegrationAnnotations copies the App Studio annotations from the IntegrationTestScenario to the PipelineRun

func (*IntegrationPipelineRun) WithIntegrationLabels

func (r *IntegrationPipelineRun) WithIntegrationLabels(integrationTestScenario *v1beta2.IntegrationTestScenario) *IntegrationPipelineRun

WithIntegrationLabels adds the type, optional flag and IntegrationTestScenario name as labels to the Integration PipelineRun.

func (*IntegrationPipelineRun) WithSnapshot

WithSnapshot adds a param containing the Snapshot as a json string to the integration PipelineRun.

Jump to

Keyboard shortcuts

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