Integrate selected builds with candidate workflows
This commit is contained in:
@@ -30,6 +30,7 @@ type Request struct {
|
||||
Product string
|
||||
Version string
|
||||
Validate func(context.Context, Candidate) error
|
||||
AfterValidate func(context.Context, Candidate) error
|
||||
Output io.Writer
|
||||
}
|
||||
|
||||
@@ -41,6 +42,11 @@ func Check(ctx context.Context, request Request) (Candidate, error) {
|
||||
if err := Validate(ctx, request, captured); err != nil {
|
||||
return Candidate{}, err
|
||||
}
|
||||
if request.AfterValidate != nil {
|
||||
if err := request.AfterValidate(ctx, captured); err != nil {
|
||||
return Candidate{}, fmt.Errorf("after candidate validation: %w", err)
|
||||
}
|
||||
}
|
||||
if err := Recheck(ctx, captured, ""); err != nil {
|
||||
return Candidate{}, err
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ type Request struct {
|
||||
Version string
|
||||
Remote string
|
||||
Validate func(context.Context, candidate.Candidate) error
|
||||
AfterValidate func(context.Context, candidate.Candidate) error
|
||||
Output io.Writer
|
||||
}
|
||||
|
||||
@@ -98,6 +99,11 @@ func Publish(ctx context.Context, request Request) (Result, error) {
|
||||
if err := candidate.Validate(ctx, checks, captured); err != nil {
|
||||
return result, err
|
||||
}
|
||||
if request.AfterValidate != nil {
|
||||
if err := request.AfterValidate(ctx, captured); err != nil {
|
||||
return result, fmt.Errorf("after candidate validation: %w", err)
|
||||
}
|
||||
}
|
||||
if err := candidate.Recheck(ctx, captured, ""); err != nil {
|
||||
return result, fmt.Errorf("post-validation local guard: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user