Class RunCondition
java.lang.Object
org.jenkins_ci.plugins.run_condition.RunCondition
- All Implemented Interfaces:
ExtensionPoint
,Describable<RunCondition>
- Direct Known Subclasses:
AlwaysPrebuildRunCondition
,And
,DayCondition
,Not
,Or
,PrebuildSameAsPerformRunCondition
,TimeCondition
public abstract class RunCondition
extends Object
implements Describable<RunCondition>, ExtensionPoint
Define a condition that can be used to decide whether to run a BuildStep or not.
A Run condition should not make any changes to the build or the build environment.
If the information that is required to make the decision is not available, then the RunCondition should
either explicitly throw an exception (or just allow one to be thrown) rather than handling it and trying to decide whether the build
should run based on bad data. This allows a user to choose what should happen - which could be different in different contexts.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionall()
abstract boolean
runPerform
(AbstractBuild<?, ?> build, BuildListener listener) Decide whether to run the perform method in the BuildStep.abstract boolean
runPrebuild
(AbstractBuild<?, ?> build, BuildListener listener) Decide whether to run the prebuild method in the BuildStep.
-
Constructor Details
-
RunCondition
public RunCondition()
-
-
Method Details
-
all
-
runPrebuild
public abstract boolean runPrebuild(AbstractBuild<?, ?> build, BuildListener listener) throws ExceptionDecide whether to run the prebuild method in the BuildStep. If the condition depends, or may depend, on something that may be affected by the build itself, then it is probably safest to always return true here. (@TODO review this once the plugin has been in use for a while with a variety of conditions and BuildSteps) If the condition is not dependent on the state of the build i.e. just looks at the build timestamp, then this method should return the same as the runPerform method.- Returns:
- true if the prebuild method of the BuildStep should run
- Throws:
Exception
- See Also:
-
runPerform
public abstract boolean runPerform(AbstractBuild<?, ?> build, BuildListener listener) throws ExceptionDecide whether to run the perform method in the BuildStep.- Returns:
- true if the perform method of the BuildStep should run
- Throws:
Exception
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<RunCondition>
-