builds

package
v4.0.0-0.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PruneBuildsRecommendedName = "builds"

Variables

This section is empty.

Functions

func BuildByBuildConfigIndexFunc

func BuildByBuildConfigIndexFunc(obj interface{}) ([]string, error)

BuildByBuildConfigIndexFunc indexes Build items by their associated BuildConfig, if none, index with key "orphan"

func NewCmdPruneBuilds

func NewCmdPruneBuilds(f kcmdutil.Factory, parentName, name string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdPruneBuilds implements the OpenShift cli prune builds command.

Types

type BuildDeleter

type BuildDeleter interface {
	DeleteBuild(build *buildv1.Build) error
}

func NewBuildDeleter

func NewBuildDeleter(client buildv1client.BuildsGetter) BuildDeleter

NewBuildDeleter creates a new buildDeleter.

type DataSet

type DataSet interface {
	GetBuildConfig(build *buildv1.Build) (*buildv1.BuildConfig, bool, error)
	ListBuildConfigs() ([]*buildv1.BuildConfig, error)
	ListBuilds() ([]*buildv1.Build, error)
	ListBuildsByBuildConfig(buildConfig *buildv1.BuildConfig) ([]*buildv1.Build, error)
}

DataSet provides functions for working with build data

func NewDataSet

func NewDataSet(buildConfigs []*buildv1.BuildConfig, builds []*buildv1.Build) DataSet

NewDataSet returns a DataSet over the specified items

type Filter

type Filter interface {
	Filter(builds []*buildv1.Build) []*buildv1.Build
}

Filter filters the set of objects

type FilterPredicate

type FilterPredicate func(build *buildv1.Build) bool

FilterPredicate is a function that returns true if the object should be included in the filtered set

func NewFilterBeforePredicate

func NewFilterBeforePredicate(d time.Duration) FilterPredicate

NewFilterBeforePredicate is a function that returns true if the build was created before the current time minus specified duration

type PruneBuildsOptions

type PruneBuildsOptions struct {
	Confirm         bool
	Orphans         bool
	KeepYoungerThan time.Duration
	KeepComplete    int
	KeepFailed      int
	Namespace       string

	BuildClient buildv1client.BuildV1Interface

	genericclioptions.IOStreams
}

PruneBuildsOptions holds all the required options for pruning builds.

func NewPruneBuildsOptions

func NewPruneBuildsOptions(streams genericclioptions.IOStreams) *PruneBuildsOptions

func (*PruneBuildsOptions) Complete

func (o *PruneBuildsOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string) error

Complete turns a partially defined PruneBuildsOptions into a solvent structure which can be validated and used for pruning builds.

func (PruneBuildsOptions) Run

func (o PruneBuildsOptions) Run() error

Run contains all the necessary functionality for the OpenShift cli prune builds command.

func (PruneBuildsOptions) Validate

func (o PruneBuildsOptions) Validate() error

Validate ensures that a PruneBuildsOptions is valid and can be used to execute pruning.

type Pruner

type Pruner interface {
	// Prune is responsible for actual removal of builds identified as candidates
	// for pruning based on pruning algorithm.
	Prune(deleter BuildDeleter) error
}

func NewPruner

func NewPruner(options PrunerOptions) Pruner

NewPruner returns a Pruner over specified data using specified options.

type PrunerOptions

type PrunerOptions struct {
	// KeepYoungerThan indicates the minimum age a BuildConfig must be to be a
	// candidate for pruning.
	KeepYoungerThan time.Duration
	// Orphans if true will include inactive orphan builds in candidate prune set
	Orphans bool
	// KeepComplete is per BuildConfig how many of the most recent builds should be preserved
	KeepComplete int
	// KeepFailed is per BuildConfig how many of the most recent failed builds should be preserved
	KeepFailed int
	// BuildConfigs is the entire list of buildconfigs across all namespaces in the cluster.
	BuildConfigs []*buildv1.BuildConfig
	// Builds is the entire list of builds across all namespaces in the cluster.
	Builds []*buildv1.Build
}

PrunerOptions contains the fields used to initialize a new Pruner.

type Resolver

type Resolver interface {
	Resolve() ([]*buildv1.Build, error)
}

Resolver knows how to resolve the set of candidate objects to prune

func NewOrphanBuildResolver

func NewOrphanBuildResolver(dataSet DataSet, BuildPhaseFilter []buildv1.BuildPhase) Resolver

NewOrphanBuildResolver returns a Resolver that matches Build objects with no associated BuildConfig and has a BuildPhase in filter

func NewPerBuildConfigResolver

func NewPerBuildConfigResolver(dataSet DataSet, keepComplete int, keepFailed int) Resolver

NewPerBuildConfigResolver returns a Resolver that selects Builds to prune per BuildConfig

Jump to

Keyboard shortcuts

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