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 Classes Modifier and Type Class Description static class
RunCondition.RunConditionDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description RunCondition()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DescriptorExtensionList<RunCondition,RunCondition.RunConditionDescriptor>
all()
RunCondition.RunConditionDescriptor
getDescriptor()
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.
-
-
-
Method Detail
-
all
public static DescriptorExtensionList<RunCondition,RunCondition.RunConditionDescriptor> all()
-
runPrebuild
public abstract boolean runPrebuild(AbstractBuild<?,?> build, BuildListener listener) throws Exception
Decide 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:
AlwaysPrebuildRunCondition
,PrebuildSameAsPerformRunCondition
-
runPerform
public abstract boolean runPerform(AbstractBuild<?,?> build, BuildListener listener) throws Exception
Decide whether to run the perform method in the BuildStep.- Returns:
- true if the perform method of the BuildStep should run
- Throws:
Exception
-
getDescriptor
public RunCondition.RunConditionDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<RunCondition>
-
-