From bf6556b0ba42afec2198916bda54e4d843fc5d42 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 24 Nov 2023 13:45:15 +0100 Subject: syz-ci: make auto-restart optional By letting syz-ci just exit on update, we make it possible to also automatically pull the latest Docker container before starting the new version. --- syz-ci/syz-ci.go | 2 ++ syz-ci/updater.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go index 00035a6ce..e1408c64e 100644 --- a/syz-ci/syz-ci.go +++ b/syz-ci/syz-ci.go @@ -79,6 +79,8 @@ var ( flagAutoUpdate = flag.Bool("autoupdate", true, "auto-update the binary (for testing)") flagManagers = flag.Bool("managers", true, "start managers (for testing)") flagDebug = flag.Bool("debug", false, "debug mode (for testing)") + // nolint: lll + flagExitOnUpgrade = flag.Bool("exit-on-upgrade", false, "exit after a syz-ci upgrade is applied; otherwise syz-ci restarts") ) type Config struct { diff --git a/syz-ci/updater.go b/syz-ci/updater.go index 9bced556a..d232451b4 100644 --- a/syz-ci/updater.go +++ b/syz-ci/updater.go @@ -194,6 +194,10 @@ func (upd *SyzUpdater) UpdateAndRestart() { if err := osutil.CopyFile(latestBin, upd.exe); err != nil { log.Fatal(err) } + if *flagExitOnUpgrade { + log.Logf(0, "exiting, please restart syz-ci to run the new version") + os.Exit(0) + } if err := syscall.Exec(upd.exe, os.Args, os.Environ()); err != nil { log.Fatal(err) } -- cgit mrf-deployment