Package hudson.plugins.promoted_builds
Class Status
java.lang.Object
hudson.plugins.promoted_builds.Status
Promotion status of a build wrt a specific
PromotionProcess
.- Author:
- Kohsuke Kawaguchi
- See Also:
-
PromotedBuildAction.statuses
-
Field Summary
Modifier and TypeFieldDescriptionfinal String
Matches withAbstractItem.name
.final Calendar
When did the build qualify for a promotion? -
Constructor Summary
ConstructorDescriptionStatus
(PromotionProcess process, Collection<? extends PromotionBadge> badges) -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildEnvVars
(AbstractBuild<?, ?> build, EnvVars env) Called byPromotion
to allow status to contribute environment variables.boolean
canBuild()
void
doBuild
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Schedules a new build.Gets the badges indicating how did a build qualify for a promotion.getDelayString
(AbstractBuild<?, ?> owner) Gets the string that says how long did it took for this build to be promoted.getIcon()
Gets the icon that should represent this promotion (that is potentially attempted but failed.)getLast()
Gets the lastPromotion
.Gets the last failedPromotion
.Gets the last successfulPromotion
.getName()
Gets the parentStatus
that owns this object.Gets thePromotionProcess
that this object deals with.getPromotionBuild
(int number) Gets the promotion build by build number.Gets all the promotion builds.Returns thePromotion
object that represents the successful promotion.AbstractBuild<?,
?> Gets the build that was qualified for a promotion.Gets the string that says how long since this promotion had happened.boolean
isFor
(PromotionProcess process) boolean
Check if the build is in queue.boolean
boolean
Checks promotion attempts.boolean
Returns true if the promotion was successfully completed.
-
Field Details
-
name
Matches withAbstractItem.name
. -
timestamp
When did the build qualify for a promotion?
-
-
Constructor Details
-
Status
-
-
Method Details
-
getName
-
getParent
Gets the parentStatus
that owns this object.- Returns:
- Promoted build action if it exists in
getTarget()
result.
-
getProcess
Gets thePromotionProcess
that this object deals with.- Returns:
- Gets the promotion process for the status.
-
getIcon
Gets the icon that should represent this promotion (that is potentially attempted but failed.)- Returns:
- Path to the SVG icon in resources or l:icon class name
-
getTarget
Gets the build that was qualified for a promotion.- Returns:
- Build reference
-
buildEnvVars
Called byPromotion
to allow status to contribute environment variables.- Parameters:
build
- The calling build. Never null.env
- Environment variables should be added to this map.
-
getTimestampString
Gets the string that says how long since this promotion had happened.- Returns:
- string like "3 minutes" "1 day" etc.
-
getDelayString
Gets the string that says how long did it took for this build to be promoted.- Parameters:
owner
- Build- Returns:
- Time span string formatted by
Util.getTimeSpanString(long)
-
isFor
-
getSuccessfulPromotion
Returns thePromotion
object that represents the successful promotion.- Parameters:
jp
- Job property- Returns:
null
if the promotion has never been successful, or if it was but the record is already lost.
-
isPromotionSuccessful
public boolean isPromotionSuccessful()Returns true if the promotion was successfully completed.- Returns:
true
if the there were successful promotions.
-
isPromotionAttempted
public boolean isPromotionAttempted()Checks promotion attempts.- Returns:
true
if at least onePromotion
activity is attempted.false
if none is executed yet (this includes the case where it's in the queue.
-
isInQueue
public boolean isInQueue()Check if the build is in queue.- Returns:
true
if the promotion for this is pending in the queue, waiting to be executed.
-
getBadges
Gets the badges indicating how did a build qualify for a promotion.- Returns:
- List of promotion badges
-
getLastSuccessful
Gets the last successfulPromotion
.- Returns:
- Last successful promotion or
null
if there is no successful ones.
-
getLastFailed
Gets the last failedPromotion
.- Returns:
- Last failed promotion or
null
if there is no failed ones.
-
getLast
Gets the lastPromotion
.- Returns:
- Last promotion or
null
if there is no promotions.
-
isLastAnError
-
getPromotionBuilds
Gets all the promotion builds.- Returns:
- List of promotions
-
getPromotionBuild
Gets the promotion build by build number.- Parameters:
number
- build number- Returns:
- promotion build
-
isManuallyApproved
public boolean isManuallyApproved() -
canBuild
public boolean canBuild() -
doBuild
@POST public void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Schedules a new build.- Parameters:
req
- Requestrsp
- Response- Throws:
IOException
- Functional errorjavax.servlet.ServletException
- Request handling error
-