Documentation ¶
Index ¶
- Constants
- func AmendTaskSpecWithRuntimeImage(cfg *config.Config, spec *v1beta1.TaskSpec, b *buildv1alpha1.Build) error
- func AmendTaskSpecWithSources(cfg *config.Config, taskSpec *v1beta1.TaskSpec, build *buildv1alpha1.Build)
- func ApplyCredentials(ctx context.Context, build *buildv1alpha1.Build, ...) bool
- func GenerateSA(ctx context.Context, client client.Client, build *buildv1alpha1.Build, ...) (serviceAccount *corev1.ServiceAccount, err error)
- func GenerateTaskRun(cfg *config.Config, build *buildv1alpha1.Build, ...) (*v1beta1.TaskRun, error)
- func GenerateTaskSpec(cfg *config.Config, build *buildv1alpha1.Build, ...) (*v1beta1.TaskSpec, error)
- func GetBuildObject(ctx context.Context, client client.Client, buildRun *buildv1alpha1.BuildRun, ...) error
- func GetGeneratedServiceAccountName(buildRun *buildv1alpha1.BuildRun) string
- func IsClientStatusUpdateError(err error) bool
- func IsGeneratedServiceAccountUsed(buildRun *buildv1alpha1.BuildRun) bool
- func IsOwnedByBuild(build *buildv1alpha1.Build, controlledReferences []metav1.OwnerReference) bool
- func IsRuntimeDefined(b *buildv1alpha1.Build) bool
- func RetrieveBuildStrategy(ctx context.Context, client client.Client, build *buildv1alpha1.Build) (*buildv1alpha1.BuildStrategy, error)
- func RetrieveClusterBuildStrategy(ctx context.Context, client client.Client, build *buildv1alpha1.Build) (*buildv1alpha1.ClusterBuildStrategy, error)
- func RetrieveServiceAccount(ctx context.Context, client client.Client, build *buildv1alpha1.Build, ...) (*corev1.ServiceAccount, error)
- func UpdateBuildRunUsingTaskRunCondition(ctx context.Context, client client.Client, buildRun *buildv1alpha1.BuildRun, ...) error
- func UpdateConditionWithFalseStatus(ctx context.Context, client client.Client, buildRun *buildv1alpha1.BuildRun, ...) error
- type ClientStatusUpdateError
- type Errors
Constants ¶
const ( ConditionUnknownStrategyKind string = "UnknownStrategyKind" ClusterBuildStrategyNotFound string = "ClusterBuildStrategyNotFound" BuildStrategyNotFound string = "BuildStrategyNotFound" ConditionSetOwnerReferenceFailed string = "SetOwnerReferenceFailed" ConditionFailed string = "Failed" ConditionTaskRunIsMissing string = "TaskRunIsMissing" ConditionTaskRunGenerationFailed string = "TaskRunGenerationFailed" ConditionServiceAccountNotFound string = "ServiceAccountNotFound" ConditionBuildRegistrationFailed string = "BuildRegistrationFailed" ConditionBuildNotFound string = "BuildNotFound" )
Common condition strings for reason, kind, etc.
const ( // DefaultServiceAccountName defines the default sa name // in vanilla Kubernetes clusters DefaultServiceAccountName = "default" // PipelineServiceAccountName defines the default sa name // in vanilla OpenShift clusters PipelineServiceAccountName = "pipeline" )
Variables ¶
This section is empty.
Functions ¶
func AmendTaskSpecWithRuntimeImage ¶
func AmendTaskSpecWithRuntimeImage( cfg *config.Config, spec *v1beta1.TaskSpec, b *buildv1alpha1.Build, ) error
AmendTaskSpecWithRuntimeImage add more steps to Tekton's Task in order to create the runtime-image.
func AmendTaskSpecWithSources ¶ added in v0.5.0
func AmendTaskSpecWithSources( cfg *config.Config, taskSpec *v1beta1.TaskSpec, build *buildv1alpha1.Build, )
AmendTaskSpecWithSources adds steps, results and volumes for spec.source and spec.sources
func ApplyCredentials ¶
func ApplyCredentials(ctx context.Context, build *buildv1alpha1.Build, buildRun *buildv1alpha1.BuildRun, serviceAccount *corev1.ServiceAccount) bool
ApplyCredentials adds all credentials that are referenced by the build and adds them to the service account. The function returns true if the service account was modified.
func GenerateSA ¶
func GenerateSA(ctx context.Context, client client.Client, build *buildv1alpha1.Build, buildRun *buildv1alpha1.BuildRun) (serviceAccount *corev1.ServiceAccount, err error)
GenerateSA generates a new service account on the fly
func GenerateTaskRun ¶
func GenerateTaskRun( cfg *config.Config, build *buildv1alpha1.Build, buildRun *buildv1alpha1.BuildRun, serviceAccountName string, strategy buildv1alpha1.BuilderStrategy, ) (*v1beta1.TaskRun, error)
GenerateTaskRun creates a Tekton TaskRun to be used for a build run
func GenerateTaskSpec ¶
func GenerateTaskSpec( cfg *config.Config, build *buildv1alpha1.Build, buildRun *buildv1alpha1.BuildRun, buildSteps []buildv1alpha1.BuildStep, ) (*v1beta1.TaskSpec, error)
GenerateTaskSpec creates Tekton TaskRun spec to be used for a build run
func GetBuildObject ¶
func GetBuildObject(ctx context.Context, client client.Client, buildRun *buildv1alpha1.BuildRun, build *buildv1alpha1.Build) error
GetBuildObject retrieves an existing Build based on a name and namespace
func GetGeneratedServiceAccountName ¶
func GetGeneratedServiceAccountName(buildRun *buildv1alpha1.BuildRun) string
GetGeneratedServiceAccountName returns the name of the generated service account for a build run
func IsClientStatusUpdateError ¶
IsClientStatusUpdateError checks whether the given error is of type ClientStatusUpdateError or in case this is a list of errors, that it contains at least one error of type ClientStatusUpdateError
func IsGeneratedServiceAccountUsed ¶
func IsGeneratedServiceAccountUsed(buildRun *buildv1alpha1.BuildRun) bool
IsGeneratedServiceAccountUsed checks if a build run uses a generated service account
func IsOwnedByBuild ¶
func IsOwnedByBuild(build *buildv1alpha1.Build, controlledReferences []metav1.OwnerReference) bool
IsOwnedByBuild checks if the controllerReferences contains a well known owner Kind
func IsRuntimeDefined ¶
func IsRuntimeDefined(b *buildv1alpha1.Build) bool
IsRuntimeDefined inspect if build has `.spec.runtime` defined, checking intermediary attributes and making sure Image is informed.
func RetrieveBuildStrategy ¶
func RetrieveBuildStrategy(ctx context.Context, client client.Client, build *buildv1alpha1.Build) (*buildv1alpha1.BuildStrategy, error)
RetrieveBuildStrategy returns a namespace scoped strategy
func RetrieveClusterBuildStrategy ¶
func RetrieveClusterBuildStrategy(ctx context.Context, client client.Client, build *buildv1alpha1.Build) (*buildv1alpha1.ClusterBuildStrategy, error)
RetrieveClusterBuildStrategy returns a cluster scoped strategy
func RetrieveServiceAccount ¶
func RetrieveServiceAccount(ctx context.Context, client client.Client, build *buildv1alpha1.Build, buildRun *buildv1alpha1.BuildRun) (*corev1.ServiceAccount, error)
RetrieveServiceAccount provides either a default sa with a referenced secret or it will generate a new sa on the fly. When not using the generate feature, it will modify and return the default sa from a k8s namespace, which is "default" or the default sa inside an openshift namespace, which is "pipeline".
func UpdateBuildRunUsingTaskRunCondition ¶
func UpdateBuildRunUsingTaskRunCondition(ctx context.Context, client client.Client, buildRun *buildv1alpha1.BuildRun, taskRun *v1beta1.TaskRun, trCondition *apis.Condition) error
UpdateBuildRunUsingTaskRunCondition updates the BuildRun Succeeded Condition
func UpdateConditionWithFalseStatus ¶
func UpdateConditionWithFalseStatus(ctx context.Context, client client.Client, buildRun *buildv1alpha1.BuildRun, errorMessage string, reason string) error
UpdateConditionWithFalseStatus sets the Succeeded condition fields and mark the condition as Status False. It also updates the object in the cluster by calling client Status Update
Types ¶
type ClientStatusUpdateError ¶
type ClientStatusUpdateError struct {
// contains filtered or unexported fields
}
ClientStatusUpdateError is an error that occurrs when trying to update a runtime object status
func (ClientStatusUpdateError) Error ¶
func (e ClientStatusUpdateError) Error() string
type Errors ¶
type Errors struct {
// contains filtered or unexported fields
}
Errors allows you to wrap multiple errors in a single struct. Useful when wrapping multiple errors with a single message.
func HandleError ¶
HandleError returns multiple errors if each error is not nil. And its error message.