diff --git a/pkg/builder/kaniko/errors.go b/pkg/builder/kaniko/errors.go index c586e21..270ced8 100644 --- a/pkg/builder/kaniko/errors.go +++ b/pkg/builder/kaniko/errors.go @@ -23,6 +23,7 @@ func (e *Error) Wrap(err error) error { } var ( + ErrBuildFailed = &Error{Code: "BuildFailed", Message: "build failed"} ErrBuildContextEmpty = &Error{Code: "BuildContextEmpty", Message: "build context cannot be empty"} ErrCleaningUp = &Error{Code: "CleaningUp", Message: "error cleaning up"} ErrCreatingJob = &Error{Code: "CreatingJob", Message: "error creating Job"} diff --git a/pkg/builder/kaniko/kaniko.go b/pkg/builder/kaniko/kaniko.go index 890d3b4..a8ed2ff 100644 --- a/pkg/builder/kaniko/kaniko.go +++ b/pkg/builder/kaniko/kaniko.go @@ -21,7 +21,7 @@ const ( kanikoContainerName = "kaniko-container" kanikoJobNamePrefix = "kaniko-build-job" - DefaultParallelism = int32(5) + DefaultParallelism = int32(1) DefaultBackoffLimit = int32(5) MinioBucketName = "kaniko" @@ -65,6 +65,10 @@ func (k *Kaniko) Build(ctx context.Context, b *builder.BuilderOptions) (logs str return "", ErrCleaningUp.Wrap(err) } + if kJob.Status.Succeeded == 0 { + return logs, ErrBuildFailed + } + return logs, nil }