Skip to content

Commit 265b799

Browse files
committed
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.
1 parent 5395074 commit 265b799

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

syz-cluster/pkg/triage/git.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ func NewGitTreeOps(dir string, sandbox bool) (*GitTreeOps, error) {
3030

3131
func (ops *GitTreeOps) HeadCommit(tree *api.Tree) (*vcs.Commit, error) {
3232
// See kernel-disk/cron.yaml.
33-
return ops.Commit(tree.Name + "-head")
33+
return ops.Git.Commit(tree.Name + "-head")
34+
}
35+
36+
func (ops *GitTreeOps) Commit(treeName, commitOrBranch string) (*vcs.Commit, error) {
37+
// See kernel-disk/cron.yaml.
38+
if vcs.CheckCommitHash(commitOrBranch) {
39+
return ops.Git.Commit(commitOrBranch)
40+
}
41+
return ops.Git.Commit(treeName + "/" + commitOrBranch)
3442
}
3543

3644
func (ops *GitTreeOps) ApplySeries(commit string, patches [][]byte) error {

syz-cluster/workflow/build-step/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func checkoutKernel(tracer debugtracer.DebugTracer, req *api.BuildRequest, serie
186186
if err != nil {
187187
return nil, err
188188
}
189-
commit, err := ops.Commit(req.CommitHash)
189+
commit, err := ops.Commit(req.TreeName, req.CommitHash)
190190
if err != nil {
191191
return nil, fmt.Errorf("failed to get commit info: %w", err)
192192
}
@@ -197,7 +197,7 @@ func checkoutKernel(tracer debugtracer.DebugTracer, req *api.BuildRequest, serie
197197
if len(patches) > 0 {
198198
tracer.Log("applying %d patches", len(patches))
199199
}
200-
err = ops.ApplySeries(req.CommitHash, patches)
200+
err = ops.ApplySeries(commit.Hash, patches)
201201
return commit, err
202202
}
203203

0 commit comments

Comments
 (0)