Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllCommand = &cli.Command{ Name: "all", Usage: "run the builder, service and api within the same process", Flags: append(cmd.NatsFlags, []cli.Flag{ &cli.IntFlag{ Name: "port", Usage: "the port to run the api on", Value: 4430, }, &cli.IntFlag{ Name: "workers", Usage: "the number of workers to run", Value: runtime.NumCPU(), EnvVars: []string{"WORKERS"}, }, &cli.BoolFlag{ Name: "ui", Usage: "enable the ui", Value: false, }, }...), Action: func(cCtx *cli.Context) error { nc, js, err := cmd.ConnectNats(cCtx) if err != nil { return fmt.Errorf("failed to connect to nats: %w", err) } defer nc.Close() s, err := store.NewStore(js, true) if err != nil { return fmt.Errorf("failed to create store: %w", err) } wg := &sync.WaitGroup{} wg.Add(3) go func() { if err := runBuilder(cCtx, s); err != nil { log.Panic().Err(err).Msg("builder failed") wg.Done() } else { wg.Add(-1) } }() go func() { if err := runService(cCtx, nc, s); err != nil { log.Panic().Err(err).Msg("service failed") wg.Done() } else { wg.Add(-1) } }() go func() { if err := runApi(cCtx, nc, js); err != nil { log.Panic().Err(err).Msg("api failed") wg.Done() } else { wg.Add(-1) } }() wg.Wait() return nil }, }
View Source
var ApiCommand = &cli.Command{ Name: "api", Usage: "run the builder api", Description: ` The builder api exposes a rest api that can be used to manage the process of building artifacts. `, Flags: append(cmd.NatsFlags, []cli.Flag{ &cli.IntFlag{ Name: "port", Usage: "the port to run the api on", Value: 4430, }, &cli.BoolFlag{ Name: "ui", Usage: "enable the ui", Value: false, }, }...), Action: func(cCtx *cli.Context) error { nc, js, err := cmd.ConnectNats(cCtx) if err != nil { return fmt.Errorf("failed to connect to nats: %w", err) } defer nc.Close() return runApi(cCtx, nc, js) }, }
View Source
var BuilderCommand = &cli.Command{ Name: "builder", Usage: "run the builder", Description: ` The builder contains serveral workers which take up the task of building artifacts. The number of workers can be configured using the --workers flag and is set to the number of cpu's by default'. `, Flags: append(cmd.NatsFlags, []cli.Flag{ &cli.IntFlag{ Name: "workers", Usage: "the number of workers to run", Value: runtime.NumCPU(), EnvVars: []string{"WORKERS"}, }, }...), Action: func(cCtx *cli.Context) error { nc, js, err := cmd.ConnectNats(cCtx) if err != nil { return fmt.Errorf("failed to connect to nats: %w", err) } defer nc.Close() s, err := store.NewStore(js, false) if err != nil { return fmt.Errorf("failed to create store: %w", err) } return runBuilder(cCtx, s) }, }
View Source
var ServiceCommand = &cli.Command{ Name: "service", Usage: "run the builder service", Description: ` The service exposes a nats micro service that can be used to manage the process of building artifacts. `, Flags: append(cmd.NatsFlags, []cli.Flag{}...), Action: func(cCtx *cli.Context) error { nc, js, err := cmd.ConnectNats(cCtx) if err != nil { return fmt.Errorf("failed to connect to nats: %w", err) } defer nc.Close() s, err := store.NewStore(js, true) if err != nil { return fmt.Errorf("failed to create store: %w", err) } return runService(cCtx, nc, s) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.