Package hudson.plugins.promoted_builds
Class Status
- java.lang.Object
-
- hudson.plugins.promoted_builds.Status
-
@ExportedBean public final class Status extends Object
Promotion status of a build wrt a specificPromotionProcess
.- Author:
- Kohsuke Kawaguchi
- See Also:
PromotedBuildAction.statuses
-
-
Field Summary
Fields Modifier and Type Field Description String
name
Matches withAbstractItem.name
.Calendar
timestamp
When did the build qualify for a promotion?
-
Constructor Summary
Constructors Constructor Description Status(PromotionProcess process, Collection<? extends PromotionBadge> badges)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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.List<PromotionBadge>
getBadges()
Gets the badges indicating how did a build qualify for a promotion.String
getDelayString(AbstractBuild<?,?> owner)
Gets the string that says how long did it took for this build to be promoted.String
getIcon()
Gets the icon that should represent this promotion (that is potentially attempted but failed.)Promotion
getLast()
Gets the lastPromotion
.Promotion
getLastFailed()
Gets the last failedPromotion
.Promotion
getLastSuccessful()
Gets the last successfulPromotion
.String
getName()
PromotedBuildAction
getParent()
Gets the parentStatus
that owns this object.PromotionProcess
getProcess()
Gets thePromotionProcess
that this object deals with.Promotion
getPromotionBuild(int number)
Gets the promotion build by build number.List<Promotion>
getPromotionBuilds()
Gets all the promotion builds.Promotion
getSuccessfulPromotion(JobPropertyImpl jp)
Returns thePromotion
object that represents the successful promotion.AbstractBuild<?,?>
getTarget()
Gets the build that was qualified for a promotion.String
getTimestampString()
Gets the string that says how long since this promotion had happened.boolean
isFor(PromotionProcess process)
boolean
isInQueue()
Check if the build is in queue.Boolean
isLastAnError()
boolean
isManuallyApproved()
boolean
isPromotionAttempted()
Checks promotion attempts.boolean
isPromotionSuccessful()
Returns true if the promotion was successfully completed.
-
-
-
Field Detail
-
name
public final String name
Matches withAbstractItem.name
.
-
timestamp
public final Calendar timestamp
When did the build qualify for a promotion?
-
-
Constructor Detail
-
Status
public Status(PromotionProcess process, Collection<? extends PromotionBadge> badges)
-
-
Method Detail
-
getName
@Exported public String getName()
-
getParent
@CheckForNull public PromotedBuildAction getParent()
Gets the parentStatus
that owns this object.- Returns:
- Promoted build action if it exists in
getTarget()
result.
-
getProcess
@Exported @CheckForNull public PromotionProcess getProcess()
Gets thePromotionProcess
that this object deals with.- Returns:
- Gets the promotion process for the status.
-
getIcon
@NonNull public String 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
@CheckForNull public AbstractBuild<?,?> getTarget()
Gets the build that was qualified for a promotion.- Returns:
- Build reference
-
buildEnvVars
public void buildEnvVars(AbstractBuild<?,?> build, EnvVars env)
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
public String getTimestampString()
Gets the string that says how long since this promotion had happened.- Returns:
- string like "3 minutes" "1 day" etc.
-
getDelayString
public String getDelayString(AbstractBuild<?,?> owner)
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
public boolean isFor(PromotionProcess process)
-
getSuccessfulPromotion
@CheckForNull public Promotion getSuccessfulPromotion(JobPropertyImpl jp)
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
@Exported public List<PromotionBadge> getBadges()
Gets the badges indicating how did a build qualify for a promotion.- Returns:
- List of promotion badges
-
getLastSuccessful
@CheckForNull public Promotion getLastSuccessful()
Gets the last successfulPromotion
.- Returns:
- Last successful promotion or
null
if there is no successful ones.
-
getLastFailed
@CheckForNull public Promotion getLastFailed()
Gets the last failedPromotion
.- Returns:
- Last failed promotion or
null
if there is no failed ones.
-
getLast
@CheckForNull public Promotion getLast()
Gets the lastPromotion
.- Returns:
- Last promotion or
null
if there is no promotions.
-
isLastAnError
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Boolean isLastAnError()
-
getPromotionBuilds
@Exported public List<Promotion> getPromotionBuilds()
Gets all the promotion builds.- Returns:
- List of promotions
-
getPromotionBuild
@CheckForNull public Promotion getPromotionBuild(int number)
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
-
-