Integrate selected builds with candidate workflows

This commit is contained in:
2026-10-05 19:38:50 +00:00
parent 5d6a6d10bd
commit e98ee0f7b9
21 changed files with 848 additions and 31 deletions

View File

@@ -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
}

View File

@@ -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)
}