diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-11-24 13:45:15 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-11-27 13:29:32 +0000 |
| commit | bf6556b0ba42afec2198916bda54e4d843fc5d42 (patch) | |
| tree | 1f1e68ffa200ae4f067422e8d8e6caaf7f859856 | |
| parent | 3f7138634be3962d395f1c13e856882690df0d3d (diff) | |
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.
| -rw-r--r-- | syz-ci/syz-ci.go | 2 | ||||
| -rw-r--r-- | syz-ci/updater.go | 4 |
2 files changed, 6 insertions, 0 deletions
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) } |
