From 265b79936233a0431f3f1032aa207af7f4a6f3c8 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 7 Aug 2025 13:50:51 +0200 Subject: 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. --- syz-cluster/pkg/triage/git.go | 10 +++++++++- syz-cluster/workflow/build-step/main.go | 4 ++-- 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 } -- cgit mrf-deployment