feat: assemble Go scheduler and backend workers
This commit is contained in:
@@ -19,12 +19,18 @@ func main() {
|
||||
}
|
||||
|
||||
func run() error {
|
||||
if len(os.Args) != 2 {
|
||||
return errors.New("usage: gitea-dynamic-runner executor")
|
||||
if len(os.Args) > 2 {
|
||||
return errors.New("usage: gitea-dynamic-runner [controller|executor]")
|
||||
}
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
switch os.Args[1] {
|
||||
command := "controller"
|
||||
if len(os.Args) == 2 {
|
||||
command = os.Args[1]
|
||||
}
|
||||
switch command {
|
||||
case "controller":
|
||||
return runController(ctx)
|
||||
case "executor":
|
||||
config, err := runnerbootstrap.ExecutorConfigFromEnvironment()
|
||||
if err != nil {
|
||||
@@ -32,6 +38,6 @@ func run() error {
|
||||
}
|
||||
return runnerbootstrap.RunExecutor(ctx, config)
|
||||
default:
|
||||
return fmt.Errorf("unknown command %q", os.Args[1])
|
||||
return fmt.Errorf("unknown command %q", command)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user