Class Status

java.lang.Object
hudson.plugins.promoted_builds.Status

@ExportedBean public final class Status extends Object
Promotion status of a build wrt a specific PromotionProcess.
Author:
Kohsuke Kawaguchi
See Also:
  • PromotedBuildAction.statuses
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      @Exported public String getName()
    • getParent

      @CheckForNull public PromotedBuildAction getParent()
      Gets the parent Status that owns this object.
      Returns:
      Promoted build action if it exists in getTarget() result.
    • getProcess

      @Exported @CheckForNull public PromotionProcess getProcess()
      Gets the PromotionProcess 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 by Promotion 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 the Promotion 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 one Promotion 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 successful Promotion.
      Returns:
      Last successful promotion or null if there is no successful ones.
    • getLastFailed

      @CheckForNull public Promotion getLastFailed()
      Gets the last failed Promotion.
      Returns:
      Last failed promotion or null if there is no failed ones.
    • getLast

      @CheckForNull public Promotion getLast()
      Gets the last Promotion.
      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 - Request
      rsp - Response
      Throws:
      IOException - Functional error
      javax.servlet.ServletException - Request handling error