Documentation ¶
Index ¶
- Constants
- Variables
- func AnnotateBuildPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, key, value string, ...) error
- func AnnotateBuildPipelineRunWithCreateSnapshotAnnotation(ctx context.Context, pipelineRun *tektonv1.PipelineRun, cl client.Client, ...) error
- func BuildPipelineRunCreatedPredicate() predicate.Predicate
- func BuildPipelineRunDeletingPredicate() predicate.Predicate
- func BuildPipelineRunFailedPredicate() predicate.Predicate
- func BuildPipelineRunSignedAndSucceededPredicate() predicate.Predicate
- func GetComponentSourceGitCommit(object client.Object) (string, error)
- func GetComponentSourceGitUrl(object client.Object) (string, error)
- func GetOutputImage(object client.Object) (string, error)
- func GetOutputImageDigest(object client.Object) (string, error)
- func GetTypeFromPipelineRun(object client.Object) (string, error)
- func IntegrationPipelineRunPredicate() predicate.Predicate
- func IsBuildPipelineRun(object client.Object) bool
- func IsIntegrationPipelineRun(object client.Object) bool
- type IntegrationPipelineRun
- func (r *IntegrationPipelineRun) AsPipelineRun() *tektonv1.PipelineRun
- func (r *IntegrationPipelineRun) WithApplicationAndComponent(application *applicationapiv1alpha1.Application, ...) *IntegrationPipelineRun
- func (r *IntegrationPipelineRun) WithEnvironmentAndDeploymentTarget(dt *applicationapiv1alpha1.DeploymentTarget, environmentName string) *IntegrationPipelineRun
- func (r *IntegrationPipelineRun) WithExtraParam(name string, value tektonv1.ParamValue) *IntegrationPipelineRun
- func (r *IntegrationPipelineRun) WithExtraParams(params []v1beta2.PipelineParameter) *IntegrationPipelineRun
- func (iplr *IntegrationPipelineRun) WithFinalizer(finalizer string) *IntegrationPipelineRun
- func (r *IntegrationPipelineRun) WithIntegrationAnnotations(its *v1beta2.IntegrationTestScenario) *IntegrationPipelineRun
- func (r *IntegrationPipelineRun) WithIntegrationLabels(integrationTestScenario *v1beta2.IntegrationTestScenario) *IntegrationPipelineRun
- func (r *IntegrationPipelineRun) WithSnapshot(snapshot *applicationapiv1alpha1.Snapshot) *IntegrationPipelineRun
Constants ¶
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" )
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 ¶
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 ¶
BuildPipelineRunCreatedPredicate returns a predicate which filters out all objects except Build PipelineRuns which have been created
func BuildPipelineRunDeletingPredicate ¶
BuildPipelineRunDeletingPredicate returns a predicate which filters out all objects except Build PipelineRuns which have been updated to deleting
func BuildPipelineRunFailedPredicate ¶
BuildPipelineRunFailedPredicate returns a predicate which filters out all objects except Build PipelineRuns which have finished and have failed.
func BuildPipelineRunSignedAndSucceededPredicate ¶
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 ¶
GetComponentSourceGitCommit returns a string containing the CHAINS-GIT_COMMIT result value from a given PipelineRun.
func GetComponentSourceGitUrl ¶
GetComponentSourceGitUrl returns a string containing the CHAINS-GIT_URL result value from a given PipelineRun.
func GetOutputImage ¶
GetOutputImage returns a string containing the output-image parameter value from a given PipelineRun.
func GetOutputImageDigest ¶
GetOutputImageDigest returns a string containing the IMAGE_DIGEST result value from a given PipelineRun.
func GetTypeFromPipelineRun ¶
GetTypeFromPipelineRun extracts the pipeline type from the pipelineRun labels.
func IntegrationPipelineRunPredicate ¶
IntegrationPipelineRunPredicate returns a predicate which filters out all objects except integration PipelineRuns that have just started or finished.
func IsBuildPipelineRun ¶
IsBuildPipelineRun returns a boolean indicating whether the object passed is a PipelineRun from the Build service or not.
func IsIntegrationPipelineRun ¶
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 ¶
func (r *IntegrationPipelineRun) WithExtraParam(name string, value tektonv1.ParamValue) *IntegrationPipelineRun
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 ¶
func (r *IntegrationPipelineRun) WithExtraParams(params []v1beta2.PipelineParameter) *IntegrationPipelineRun
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 ¶
func (r *IntegrationPipelineRun) WithIntegrationAnnotations(its *v1beta2.IntegrationTestScenario) *IntegrationPipelineRun
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 ¶
func (r *IntegrationPipelineRun) WithSnapshot(snapshot *applicationapiv1alpha1.Snapshot) *IntegrationPipelineRun
WithSnapshot adds a param containing the Snapshot as a json string to the integration PipelineRun.