From a0d21425bbfff7ba2e95d6338f551357c67cdba0 Mon Sep 17 00:00:00 2001 From: Grigory Bazilevich Date: Thu, 12 Mar 2026 10:50:46 +0300 Subject: syz-ci: make rebuild periods configurable Signed-off-by: Denis Efremov --- pkg/updater/updater.go | 73 ++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'pkg') diff --git a/pkg/updater/updater.go b/pkg/updater/updater.go index 6cf56c63d..fc575a004 100644 --- a/pkg/updater/updater.go +++ b/pkg/updater/updater.go @@ -20,8 +20,8 @@ import ( ) const ( - RebuildPeriod = 12 * time.Hour - BuildRetryPeriod = 10 * time.Minute // used for both syzkaller and kernel + DefaultRebuildPeriod = 12 * time.Hour + BuildRetryPeriod = 10 * time.Minute // used for both syzkaller and kernel ) // Updater handles everything related to syzkaller updates. @@ -32,30 +32,32 @@ const ( // Additionally it updates and restarts the current executable as necessary. // Current executable is always built on the same revision as the rest of syzkaller binaries. type Updater struct { - repo vcs.Repo - exe string - repoAddress string - branch string - descriptions string - gopathDir string - syzkallerDir string - latestDir string - currentDir string - syzFiles map[string]bool - compilerID string - cfg *Config + repo vcs.Repo + exe string + repoAddress string + branch string + descriptions string + rebuildPeriod time.Duration + gopathDir string + syzkallerDir string + latestDir string + currentDir string + syzFiles map[string]bool + compilerID string + cfg *Config } type Config struct { // If set, exit on updates instead of restarting the current binary. - ExitOnUpdate bool - BuildSem *osutil.Semaphore - ReportBuildError func(commit *vcs.Commit, compilerID string, buildErr error) - SyzkallerRepo string - SyzkallerBranch string - SyzkallerDescriptions string - Targets map[Target]bool - MakeTargets []string // host make targets to build besides the targets-specific ones + ExitOnUpdate bool + BuildSem *osutil.Semaphore + ReportBuildError func(commit *vcs.Commit, compilerID string, buildErr error) + SyzkallerRepo string + SyzkallerBranch string + SyzkallerDescriptions string + SyzkallerRebuildPeriod int + Targets map[Target]bool + MakeTargets []string // host make targets to build besides the targets-specific ones } type Target struct { @@ -107,18 +109,19 @@ func New(cfg *Config) (*Updater, error) { return nil, err } return &Updater{ - repo: vcs.NewSyzkallerRepo(syzkallerDir), - exe: exe, - repoAddress: cfg.SyzkallerRepo, - branch: cfg.SyzkallerBranch, - descriptions: cfg.SyzkallerDescriptions, - gopathDir: gopath, - syzkallerDir: syzkallerDir, - latestDir: filepath.Join("syzkaller", "latest"), - currentDir: filepath.Join("syzkaller", "current"), - syzFiles: syzFiles, - compilerID: strings.TrimSpace(string(compilerID)), - cfg: cfg, + repo: vcs.NewSyzkallerRepo(syzkallerDir), + exe: exe, + repoAddress: cfg.SyzkallerRepo, + branch: cfg.SyzkallerBranch, + descriptions: cfg.SyzkallerDescriptions, + rebuildPeriod: time.Duration(cfg.SyzkallerRebuildPeriod) * time.Second, + gopathDir: gopath, + syzkallerDir: syzkallerDir, + latestDir: filepath.Join("syzkaller", "latest"), + currentDir: filepath.Join("syzkaller", "current"), + syzFiles: syzFiles, + compilerID: strings.TrimSpace(string(compilerID)), + cfg: cfg, }, nil } @@ -195,7 +198,7 @@ func (upd *Updater) UpdateOnStart(autoupdate bool, updatePending, shutdown chan // waitForUpdate polls and rebuilds syzkaller. // Returns when we have a new good build in latest. func (upd *Updater) waitForUpdate() { - time.Sleep(RebuildPeriod) + time.Sleep(upd.rebuildPeriod) latestTag := upd.checkLatest() lastCommit := latestTag for { -- cgit mrf-deployment