Documentation ¶
Index ¶
- func GetNextConfigBuild(lister buildclient.BuildLister, namespace, buildConfigName string) ([]*buildapi.Build, bool, error)
- func NewNoBuildNumberAnnotationError(build *buildapi.Build) error
- type NoBuildNumberAnnotationError
- type ParallelPolicy
- type RunPolicy
- type SerialLatestOnlyPolicy
- type SerialPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNextConfigBuild ¶
func GetNextConfigBuild(lister buildclient.BuildLister, namespace, buildConfigName string) ([]*buildapi.Build, bool, error)
GetNextConfigBuild returns the build that will be executed next for the given build configuration. It also returns the indication whether there are currently running builds, to make sure there is no race-condition between re-listing the builds.
Types ¶
type NoBuildNumberAnnotationError ¶
type NoBuildNumberAnnotationError struct {
// contains filtered or unexported fields
}
NoBuildNumberLabelError represents an error caused by the build not having the required build number annotation.
func (NoBuildNumberAnnotationError) Error ¶
func (e NoBuildNumberAnnotationError) Error() string
type ParallelPolicy ¶
type ParallelPolicy struct { BuildLister buildclient.BuildLister BuildUpdater buildclient.BuildUpdater }
ParallelPolicy implements the RunPolicy interface. Build created using this run policy will always run as soon as they are created. This run policy does not guarantee that the builds will complete in same order as they were created and using this policy might cause unpredictable behavior.
func (*ParallelPolicy) Handles ¶
func (s *ParallelPolicy) Handles(policy buildapi.BuildRunPolicy) bool
Handles returns true for the build run parallel policy
func (*ParallelPolicy) IsRunnable ¶
func (s *ParallelPolicy) IsRunnable(build *buildapi.Build) (bool, error)
IsRunnable implements the RunPolicy interface. The parallel builds are run as soon as they are created. There is no build queue as all build run asynchronously.
func (*ParallelPolicy) OnComplete ¶
func (s *ParallelPolicy) OnComplete(build *buildapi.Build) error
OnComplete implements the RunPolicy interface.
type RunPolicy ¶
type RunPolicy interface { // IsRunnable returns true of the given build should be executed. IsRunnable(*buildapi.Build) (bool, error) // OnComplete allows policy to execute action when the given build just // completed. OnComplete(*buildapi.Build) error // Handles returns true if the run policy handles a specific policy Handles(buildapi.BuildRunPolicy) bool }
RunPolicy is an interface that define handler for the build runPolicy field. The run policy controls how and when the new builds are 'run'.
func GetAllRunPolicies ¶
func GetAllRunPolicies(lister buildclient.BuildLister, updater buildclient.BuildUpdater) []RunPolicy
GetAllRunPolicies returns a set of all run policies.
type SerialLatestOnlyPolicy ¶
type SerialLatestOnlyPolicy struct { BuildUpdater buildclient.BuildUpdater BuildLister buildclient.BuildLister }
SerialLatestOnlyPolicy implements the RunPolicy interface. This variant of the serial build policy makes sure that builds are executed in same order as they were created, but when a new build is created, the previous, queued build is cancelled, always making the latest created build run as next. This will produce consistent results, but might not suit the CI/CD flow where user expect that every commit is built.
func (*SerialLatestOnlyPolicy) Handles ¶
func (s *SerialLatestOnlyPolicy) Handles(policy buildapi.BuildRunPolicy) bool
Handles returns true for the build run serial latest only policy
func (*SerialLatestOnlyPolicy) IsRunnable ¶
func (s *SerialLatestOnlyPolicy) IsRunnable(build *buildapi.Build) (bool, error)
IsRunnable implements the RunPolicy interface. Calling this function on a build mean that any previous build that is in 'new' phase will be automatically cancelled. This will also cancel any "serial" build (when you changed the build config run policy on-the-fly).
func (*SerialLatestOnlyPolicy) OnComplete ¶
func (s *SerialLatestOnlyPolicy) OnComplete(build *buildapi.Build) error
IsRunnable implements the Scheduler interface.
type SerialPolicy ¶
type SerialPolicy struct { BuildLister buildclient.BuildLister BuildUpdater buildclient.BuildUpdater }
SerialPolicy implements the RunPolicy interface. Using this run policy, every created build is put into a queue. The serial run policy guarantees that all builds are executed synchroniously in the same order as they were created. This will produce consistent results, but block the build execution until the previous builds are complete.
func (*SerialPolicy) Handles ¶
func (s *SerialPolicy) Handles(policy buildapi.BuildRunPolicy) bool
Handles returns true for the build run serial policy
func (*SerialPolicy) IsRunnable ¶
func (s *SerialPolicy) IsRunnable(build *buildapi.Build) (bool, error)
IsRunnable implements the RunPolicy interface.
func (*SerialPolicy) OnComplete ¶
func (s *SerialPolicy) OnComplete(build *buildapi.Build) error
OnComplete implements the RunPolicy interface.