feat: add once flag to daemon command (#19) (#598)

Once flag polls and completes one job then exits.

I use this with Windows Sandbox (and creating users with local brew install on Mac) to create a fresh environment every time.

Co-authored-by: Garet Halliday <[email protected]>
Co-authored-by: Jason Song <[email protected]>
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/598
Reviewed-by: techknowlogick <[email protected]>
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: garet90 <[email protected]>
Co-committed-by: garet90 <[email protected]>
This commit is contained in:
garet90
2024-11-06 17:16:08 +00:00
committed by techknowlogick
co-authored by Garet Halliday Jason Song
parent 0348aaac59
commit 8bc0275e74
3 changed files with 50 additions and 5 deletions
+4 -2
View File
@@ -42,12 +42,14 @@ func Execute(ctx context.Context) {
rootCmd.AddCommand(registerCmd)
// ./act_runner daemon
var daemArgs daemonArgs
daemonCmd := &cobra.Command{
Use: "daemon",
Short: "Run as a runner daemon",
Args: cobra.MaximumNArgs(1),
RunE: runDaemon(ctx, &configFile),
Args: cobra.MaximumNArgs(0),
RunE: runDaemon(ctx, &daemArgs, &configFile),
}
daemonCmd.Flags().BoolVar(&daemArgs.Once, "once", false, "Run one job then exit")
rootCmd.AddCommand(daemonCmd)
// ./act_runner exec