feat: run official executor behind SPIFFE mTLS
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"git.ddupan.top/panxiao81/gitea-dynamic-runner/internal/runnerbootstrap"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run() error {
|
||||
if len(os.Args) != 2 {
|
||||
return errors.New("usage: gitea-dynamic-runner executor")
|
||||
}
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
switch os.Args[1] {
|
||||
case "executor":
|
||||
config, err := runnerbootstrap.ExecutorConfigFromEnvironment()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return runnerbootstrap.RunExecutor(ctx, config)
|
||||
default:
|
||||
return fmt.Errorf("unknown command %q", os.Args[1])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user