diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-08-19 18:35:03 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-08-20 12:09:28 +0000 |
| commit | 07e4cfe1a310e14ffab04f10e3326d5201dddaf9 (patch) | |
| tree | de96483361831106dd290346c6c60dfafc0d229e /syz-cluster/workflow | |
| parent | b2b57c77e053311868ed13aea7b168dbc63d0696 (diff) | |
syz-cluster: improve build step's status reporting
In case of an infrastructure-related error, do not report the build as
failed, but rather just report the error status for the particular
session test.
Diffstat (limited to 'syz-cluster/workflow')
| -rw-r--r-- | syz-cluster/workflow/build-step/main.go | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/syz-cluster/workflow/build-step/main.go b/syz-cluster/workflow/build-step/main.go index dcbf9038b..7d260ea9c 100644 --- a/syz-cluster/workflow/build-step/main.go +++ b/syz-cluster/workflow/build-step/main.go @@ -81,7 +81,8 @@ func main() { ret := &BuildResult{} if err != nil { log.Printf("failed to checkout: %v", err) - uploadReq.Log = []byte(err.Error()) + reportResults(ctx, client, nil, nil, []byte(err.Error())) + return } else { if *flagSmokeBuild { skip, err := alreadyBuilt(ctx, client, uploadReq) @@ -95,7 +96,8 @@ func main() { ret, err = buildKernel(tracer, req) if err != nil { log.Printf("build process failed: %v", err) - uploadReq.Log = []byte(err.Error()) + reportResults(ctx, client, nil, nil, []byte(err.Error())) + return } else { uploadReq.Compiler = ret.Compiler uploadReq.Config = ret.Config @@ -108,19 +110,29 @@ func main() { } } } - reportResults(ctx, client, req.SeriesID != "", uploadReq, ret.Finding, output.Bytes()) + reportResults(ctx, client, uploadReq, ret.Finding, output.Bytes()) } -func reportResults(ctx context.Context, client *api.Client, patched bool, +func reportResults(ctx context.Context, client *api.Client, uploadReq *api.UploadBuildReq, finding *api.NewFinding, output []byte) { - buildInfo, err := client.UploadBuild(ctx, uploadReq) - if err != nil { - app.Fatalf("failed to upload build: %v", err) + var buildID string + status := api.TestPassed + if uploadReq != nil { + if !uploadReq.BuildSuccess { + status = api.TestFailed + } + buildInfo, err := client.UploadBuild(ctx, uploadReq) + if err != nil { + app.Fatalf("failed to upload build: %v", err) + } + log.Printf("uploaded build, reply: %q", buildInfo) + buildID = buildInfo.ID + } else { + status = api.TestError } - log.Printf("uploaded build, reply: %q", buildInfo) osutil.WriteJSON(filepath.Join(*flagOutput, "result.json"), &api.BuildResult{ - BuildID: buildInfo.ID, - Success: uploadReq.BuildSuccess, + BuildID: buildID, + Success: status == api.TestPassed, }) if *flagSmokeBuild { return @@ -128,18 +140,15 @@ func reportResults(ctx context.Context, client *api.Client, patched bool, testResult := &api.TestResult{ SessionID: *flagSession, TestName: *flagTestName, - Result: api.TestFailed, + Result: status, Log: output, } - if uploadReq.BuildSuccess { - testResult.Result = api.TestPassed - } - if patched { - testResult.PatchedBuildID = buildInfo.ID + if uploadReq.SeriesID != "" { + testResult.PatchedBuildID = buildID } else { - testResult.BaseBuildID = buildInfo.ID + testResult.BaseBuildID = buildID } - err = client.UploadTestResult(ctx, testResult) + err := client.UploadTestResult(ctx, testResult) if err != nil { app.Fatalf("failed to report the test result: %v", err) } |
