Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ControllerCmd = &cobra.Command{ Use: "controller", Short: "Start the VCS Webhook handler.", Long: ``, Run: func(cmd *cobra.Command, args []string) { clientType := viper.GetString("vcs-type") client, err := createVCSClient(clientType) if err != nil { log.Fatal().Err(err).Msg("failed to create vcs client") } cfg := config.ServerConfig{ UrlPrefix: viper.GetString("webhook-url-prefix"), WebhookSecret: viper.GetString("webhook-secret"), VcsClient: client, } log.Info().Msg("Initializing git settings") if err := repo.InitializeGitSettings(cfg.VcsClient.Username(), cfg.VcsClient.Email()); err != nil { log.Fatal().Err(err).Msg("failed to initialize git settings") } fmt.Println("Starting KubeChecks:", pkg.GitTag, pkg.GitCommit) ctx := context.Background() server := server.NewServer(ctx, &cfg) go server.Start(ctx) sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGTERM) done := make(chan bool, 1) go func() { sig := <-sigs log.Debug().Str("signal", sig.String()).Msg("received signal") done <- true }() <-done log.Info().Msg("shutting down...") for events.GetInFlight() > 0 { log.Info().Int("count", events.GetInFlight()).Msg("waiting for in-flight requests to complete") time.Sleep(time.Second * 3) } log.Info().Msg("good bye.") }, PreRunE: func(cmd *cobra.Command, args []string) error { log.Info().Msg("Server Configuration: ") log.Info().Msgf("Webhook URL Base: %s", viper.GetString("webhook-url-base")) log.Info().Msgf("Webhook URL Prefix: %s", viper.GetString("webhook-url-prefix")) log.Info().Msgf("VCS Type: %s", viper.GetString("vcs-type")) return nil }, }
ControllerCmd represents the run command
View Source
var RootCmd = &cobra.Command{ Use: "kubechecks", Short: "Argo Git Hooks", Long: `A Kubernetes controller and webhook server for integration of ArgoCD applications into CI`, PersistentPreRun: func(cmd *cobra.Command, args []string) {}, }
RootCmd represents the base command when called without any subcommands
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func ViperNameToEnv ¶ added in v1.0.8
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.