commands

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Root = &cobra.Command{
	Use:   "brigade-vacuum",
	Short: "Clean up old Brigade builds",
	Long:  mainUsage,
	RunE: func(cmd *cobra.Command, args []string) error {
		a := getAge()
		mb := maxBuilds()
		srb := getSkipRunningBuilds()
		if a == "" && mb == 0 {
			return errors.New("one of --age or --max-builds must be greater than zero")
		}
		var age = vacuum.NoMaxAge
		if a != "" {
			dur, err := time.ParseDuration(a)
			if err != nil {
				return err
			}
			age = time.Now().Add(-dur)
		}
		c, err := kube.GetClient("", kubeConfigPath())
		if err != nil {
			return err
		}
		if globalVerbose {
			fmt.Fprintf(os.Stderr, "Max Age: %s\nMax Builds: %d\n", age, mb)
		}
		return vacuum.New(age, mb, srb, c, ns()).Run()
	},
}

Root is the top-level command, which just prints help text.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL