Documentation ¶
Index ¶
- Constants
- func AmendTaskSpecWithSources(cfg *config.Config, taskSpec *pipelineapi.TaskSpec, build *buildv1beta1.Build, ...)
- func ApplyCredentials(ctx context.Context, build *buildv1beta1.Build, ...) bool
- func CheckTaskRunVolumesExist(ctx context.Context, client client.Client, taskRun *pipelineapi.TaskRun) error
- func DeleteServiceAccount(ctx context.Context, client client.Client, ...) error
- func FindParamValueByName(paramValues []buildv1beta1.ParamValue, name string) *buildv1beta1.ParamValue
- func FindParameterByName(parameters []buildv1beta1.Parameter, name string) *buildv1beta1.Parameter
- func GenerateSA(ctx context.Context, client client.Client, build *buildv1beta1.Build, ...) (serviceAccount *corev1.ServiceAccount, err error)
- func GenerateTaskRun(cfg *config.Config, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun, ...) (*pipelineapi.TaskRun, error)
- func GenerateTaskSpec(cfg *config.Config, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun, ...) (*pipelineapi.TaskSpec, error)
- func GetBuildObject(ctx context.Context, client client.Client, buildRun *buildv1beta1.BuildRun, ...) error
- func GetGeneratedServiceAccountName(buildRun *buildv1beta1.BuildRun) string
- func GetVulnerabilityScanOptions(buildOutput, buildRunOutput build.Image) *build.VulnerabilityScanOptions
- func HandleTaskRunParam(taskRun *pipelineapi.TaskRun, parameterDefinition *buildv1beta1.Parameter, ...) error
- func IsClientStatusUpdateError(err error) bool
- func IsGeneratedServiceAccountUsed(buildRun *buildv1beta1.BuildRun) bool
- func IsOwnedByBuild(build *buildv1beta1.Build, controlledReferences []metav1.OwnerReference) bool
- func IsSystemReservedParameter(param string) bool
- func OverrideParams(originalParams []buildv1beta1.ParamValue, ...) []buildv1beta1.ParamValue
- func RetrieveBuildStrategy(ctx context.Context, client client.Client, build *buildv1beta1.Build) (*buildv1beta1.BuildStrategy, error)
- func RetrieveClusterBuildStrategy(ctx context.Context, client client.Client, build *buildv1beta1.Build) (*buildv1beta1.ClusterBuildStrategy, error)
- func RetrieveServiceAccount(ctx context.Context, client client.Client, build *buildv1beta1.Build, ...) (serviceAccount *corev1.ServiceAccount, err error)
- func SetupImageProcessing(taskRun *pipelineapi.TaskRun, cfg *config.Config, creationTimestamp time.Time, ...) error
- func UpdateBuildRunUsingTaskFailures(ctx context.Context, client client.Client, buildRun *buildv1beta1.BuildRun, ...)
- func UpdateBuildRunUsingTaskResults(ctx context.Context, buildRun *build.BuildRun, ...)
- func UpdateBuildRunUsingTaskRunCondition(ctx context.Context, client client.Client, buildRun *buildv1beta1.BuildRun, ...) error
- func UpdateConditionWithFalseStatus(ctx context.Context, client client.Client, buildRun *buildv1beta1.BuildRun, ...) error
- type ClientStatusUpdateError
- type Errors
- type VulnerablilityScanParams
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" ConditionMissingParameterValues string = "MissingParameterValues" ConditionRestrictedParametersInUse string = "RestrictedParametersInUse" ConditionUndefinedParameter string = "UndefinedParameter" ConditionWrongParameterValueType string = "WrongParameterValueType" ConditionInconsistentParameterValues string = "InconsistentParameterValues" ConditionEmptyArrayItemParameterValues string = "EmptyArrayItemParameterValues" ConditionIncompleteConfigMapValueParameterValues string = "IncompleteConfigMapValueParameterValues" ConditionIncompleteSecretValueParameterValues string = "IncompleteSecretValueParameterValues" BuildRunNameInvalid string = "BuildRunNameInvalid" BuildRunNoRefOrSpec string = "BuildRunNoRefOrSpec" BuildRunAmbiguousBuild string = "BuildRunAmbiguousBuild" BuildRunBuildFieldOverrideForbidden string = "BuildRunBuildFieldOverrideForbidden" )
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 AmendTaskSpecWithSources ¶ added in v0.5.0
func AmendTaskSpecWithSources( cfg *config.Config, taskSpec *pipelineapi.TaskSpec, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun, )
AmendTaskSpecWithSources adds the necessary steps to either wait for user upload ("LocalCopy"), or alternatively, configures the Task steps to use bundle and "git clone".
func ApplyCredentials ¶
func ApplyCredentials(ctx context.Context, build *buildv1beta1.Build, buildRun *buildv1beta1.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 CheckTaskRunVolumesExist ¶ added in v0.10.0
func CheckTaskRunVolumesExist(ctx context.Context, client client.Client, taskRun *pipelineapi.TaskRun) error
CheckTaskRunVolumesExist tries to find some of the volumes referenced by the BuildRun with all the overrides. If some secret or configmap does not exist in the namespace, function returns error describing the missing resource
func DeleteServiceAccount ¶ added in v0.6.0
func DeleteServiceAccount(ctx context.Context, client client.Client, completedBuildRun *buildv1beta1.BuildRun) error
DeleteServiceAccount deletes the service account of a completed BuildRun if the service account was generated
func FindParamValueByName ¶ added in v0.8.0
func FindParamValueByName(paramValues []buildv1beta1.ParamValue, name string) *buildv1beta1.ParamValue
FindParamValueByName returns the first entry in a ParamValue array with a specified name, or nil
func FindParameterByName ¶ added in v0.8.0
func FindParameterByName(parameters []buildv1beta1.Parameter, name string) *buildv1beta1.Parameter
FindParameterByName returns the first entry in a Parameter array with a specified name, or nil
func GenerateSA ¶
func GenerateSA(ctx context.Context, client client.Client, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun) (serviceAccount *corev1.ServiceAccount, err error)
GenerateSA generates a new service account on the fly
func GenerateTaskRun ¶
func GenerateTaskRun( cfg *config.Config, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun, serviceAccountName string, strategy buildv1beta1.BuilderStrategy, ) (*pipelineapi.TaskRun, error)
GenerateTaskRun creates a Tekton TaskRun to be used for a build run
func GenerateTaskSpec ¶
func GenerateTaskSpec( cfg *config.Config, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun, buildSteps []buildv1beta1.Step, parameterDefinitions []buildv1beta1.Parameter, buildStrategyVolumes []buildv1beta1.BuildStrategyVolume, ) (*pipelineapi.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 *buildv1beta1.BuildRun, build *buildv1beta1.Build) error
GetBuildObject retrieves an existing Build based on a name and namespace
func GetGeneratedServiceAccountName ¶
func GetGeneratedServiceAccountName(buildRun *buildv1beta1.BuildRun) string
GetGeneratedServiceAccountName returns the name of the generated service account for a build run
func GetVulnerabilityScanOptions ¶ added in v0.14.0
func GetVulnerabilityScanOptions(buildOutput, buildRunOutput build.Image) *build.VulnerabilityScanOptions
func HandleTaskRunParam ¶ added in v0.8.0
func HandleTaskRunParam(taskRun *pipelineapi.TaskRun, parameterDefinition *buildv1beta1.Parameter, paramValue buildv1beta1.ParamValue) error
HandleTaskRunParam makes the necessary changes to a TaskRun for a parameter
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 *buildv1beta1.BuildRun) bool
IsGeneratedServiceAccountUsed checks if a build run uses a generated service account
func IsOwnedByBuild ¶
func IsOwnedByBuild(build *buildv1beta1.Build, controlledReferences []metav1.OwnerReference) bool
IsOwnedByBuild checks if the controllerReferences contains a well known owner Kind
func IsSystemReservedParameter ¶ added in v0.6.0
IsSystemReservedParameter verifies if we are using a system reserved parameter name
func OverrideParams ¶ added in v0.9.0
func OverrideParams(originalParams []buildv1beta1.ParamValue, overrideParams []buildv1beta1.ParamValue) []buildv1beta1.ParamValue
OverrideParams allows to override an existing list of parameters with a second list, as long as their entry names matches
func RetrieveBuildStrategy ¶
func RetrieveBuildStrategy(ctx context.Context, client client.Client, build *buildv1beta1.Build) (*buildv1beta1.BuildStrategy, error)
RetrieveBuildStrategy returns a namespace scoped strategy
func RetrieveClusterBuildStrategy ¶
func RetrieveClusterBuildStrategy(ctx context.Context, client client.Client, build *buildv1beta1.Build) (*buildv1beta1.ClusterBuildStrategy, error)
RetrieveClusterBuildStrategy returns a cluster scoped strategy
func RetrieveServiceAccount ¶
func RetrieveServiceAccount(ctx context.Context, client client.Client, build *buildv1beta1.Build, buildRun *buildv1beta1.BuildRun) (serviceAccount *corev1.ServiceAccount, err 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 SetupImageProcessing ¶ added in v0.12.0
func SetupImageProcessing(taskRun *pipelineapi.TaskRun, cfg *config.Config, creationTimestamp time.Time, buildOutput, buildRunOutput build.Image) error
SetupImageProcessing appends the image-processing step to a TaskRun if desired
func UpdateBuildRunUsingTaskFailures ¶ added in v0.8.0
func UpdateBuildRunUsingTaskFailures(ctx context.Context, client client.Client, buildRun *buildv1beta1.BuildRun, taskRun *pipelineapi.TaskRun)
UpdateBuildRunUsingTaskFailures is extracting failures from taskRun steps and adding them to buildRun (mutates)
func UpdateBuildRunUsingTaskResults ¶ added in v0.6.0
func UpdateBuildRunUsingTaskResults( ctx context.Context, buildRun *build.BuildRun, taskRunResult []pipelineapi.TaskRunResult, request reconcile.Request, )
UpdateBuildRunUsingTaskResults surface the task results to the buildrun
func UpdateBuildRunUsingTaskRunCondition ¶
func UpdateBuildRunUsingTaskRunCondition(ctx context.Context, client client.Client, buildRun *buildv1beta1.BuildRun, taskRun *pipelineapi.TaskRun, trCondition *apis.Condition) error
UpdateBuildRunUsingTaskRunCondition updates the BuildRun Succeeded Condition
func UpdateConditionWithFalseStatus ¶
func UpdateConditionWithFalseStatus(ctx context.Context, client client.Client, buildRun *buildv1beta1.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.
type VulnerablilityScanParams ¶ added in v0.14.0
type VulnerablilityScanParams struct {
build.VulnerabilityScanOptions
}
func (*VulnerablilityScanParams) Set ¶ added in v0.14.0
func (v *VulnerablilityScanParams) Set(s string) error
func (*VulnerablilityScanParams) String ¶ added in v0.14.0
func (v *VulnerablilityScanParams) String() string
func (*VulnerablilityScanParams) Type ¶ added in v0.14.0
func (v *VulnerablilityScanParams) Type() string