aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-08-07 13:50:51 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-08-08 10:25:41 +0000
commit265b79936233a0431f3f1032aa207af7f4a6f3c8 (patch)
treec9bd46e7627f302be44539acc660c42fe865d4cc
parent53950748be0bac4ec27d0f34662c538824609845 (diff)
syz-cluster: support branch checkout in build-step
During smoke builds, we may have a tree name/branch name pair instead of just a commit hash, which is the case for normal kernel build requests. Support both types of requests.
-rw-r--r--syz-cluster/pkg/triage/git.go10
-rw-r--r--syz-cluster/workflow/build-step/main.go4
2 files changed, 11 insertions, 3 deletions
diff --git a/syz-cluster/pkg/triage/git.go b/syz-cluster/pkg/triage/git.go
index db8f6b629..7eab776c9 100644
--- a/syz-cluster/pkg/triage/git.go
+++ b/syz-cluster/pkg/triage/git.go
@@ -30,7 +30,15 @@ func NewGitTreeOps(dir string, sandbox bool) (*GitTreeOps, error) {
func (ops *GitTreeOps) HeadCommit(tree *api.Tree) (*vcs.Commit, error) {
// See kernel-disk/cron.yaml.
- return ops.Commit(tree.Name + "-head")
+ return ops.Git.Commit(tree.Name + "-head")
+}
+
+func (ops *GitTreeOps) Commit(treeName, commitOrBranch string) (*vcs.Commit, error) {
+ // See kernel-disk/cron.yaml.
+ if vcs.CheckCommitHash(commitOrBranch) {
+ return ops.Git.Commit(commitOrBranch)
+ }
+ return ops.Git.Commit(treeName + "/" + commitOrBranch)
}
func (ops *GitTreeOps) ApplySeries(commit string, patches [][]byte) error {
diff --git a/syz-cluster/workflow/build-step/main.go b/syz-cluster/workflow/build-step/main.go
index 80ef8aa67..dcbf9038b 100644
--- a/syz-cluster/workflow/build-step/main.go
+++ b/syz-cluster/workflow/build-step/main.go
@@ -186,7 +186,7 @@ func checkoutKernel(tracer debugtracer.DebugTracer, req *api.BuildRequest, serie
if err != nil {
return nil, err
}
- commit, err := ops.Commit(req.CommitHash)
+ commit, err := ops.Commit(req.TreeName, req.CommitHash)
if err != nil {
return nil, fmt.Errorf("failed to get commit info: %w", err)
}
@@ -197,7 +197,7 @@ func checkoutKernel(tracer debugtracer.DebugTracer, req *api.BuildRequest, serie
if len(patches) > 0 {
tracer.Log("applying %d patches", len(patches))
}
- err = ops.ApplySeries(req.CommitHash, patches)
+ err = ops.ApplySeries(commit.Hash, patches)
return commit, err
}