Skip to content

Commit

Permalink
fix: builder error propagation (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-esk authored Feb 2, 2024
1 parent cf20f4a commit 8e490c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/builder/kaniko/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
6 changes: 5 additions & 1 deletion pkg/builder/kaniko/kaniko.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
kanikoContainerName = "kaniko-container"
kanikoJobNamePrefix = "kaniko-build-job"

DefaultParallelism = int32(5)
DefaultParallelism = int32(1)
DefaultBackoffLimit = int32(5)

MinioBucketName = "kaniko"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 8e490c5

Please sign in to comment.