java.lang.Object
au.com.centrumsystems.hudson.plugin.buildpipeline.PipelineBuild

public class PipelineBuild extends Object
Author:
Centrum Systems
  • Constructor Details

    • PipelineBuild

      public PipelineBuild()
      Default constructor
    • PipelineBuild

      public PipelineBuild(AbstractBuild<?,?> build, AbstractProject<?,?> project, AbstractBuild<?,?> previousBuild)
      Creates a new PipelineBuild with currentBuild, project and upstreamBuild set.
      Parameters:
      build - - current build
      project - - current project
      previousBuild - - upstream build
    • PipelineBuild

      public PipelineBuild(AbstractBuild<?,?> build)
      Convenience method to create PipelineBuild from a build.
      Parameters:
      build - The object to be wrapped.
    • PipelineBuild

      public PipelineBuild(FreeStyleProject project)
      Parameters:
      project - project
  • Method Details

    • getCurrentBuild

      public AbstractBuild<?,?> getCurrentBuild()
    • setCurrentBuild

      public void setCurrentBuild(AbstractBuild<?,?> currentBuild)
    • getUpstreamBuild

      public AbstractBuild<?,?> getUpstreamBuild()
    • setUpstreamBuild

      public void setUpstreamBuild(AbstractBuild<?,?> upstreamBuild)
    • setProject

      public void setProject(AbstractProject<?,?> currentProject)
    • getProject

      public AbstractProject<?,?> getProject()
      Returns the project name. If the current project is null the project name is determined using the current build.
      Returns:
      - Project name
    • getCurrentBuildNumber

      public String getCurrentBuildNumber()
      Returns the current build number.
      Returns:
      - Current build number or empty String is the current build is null.
    • getDownstreamPipeline

      public List<PipelineBuild> getDownstreamPipeline()
      Constructs a List of downstream PipelineBuild objects that make up the current pipeline.
      Returns:
      - List of downstream PipelineBuild objects that make up the current pipeline.
    • getBuildResultURL

      public String getBuildResultURL()
      Build a URL of the currentBuild
      Returns:
      URL of the currentBuild
    • getProjectURL

      public String getProjectURL()
      Builds a URL of the current project
      Returns:
      URL - of the project
    • getCurrentBuildResult

      public String getCurrentBuildResult()
      Determines the result of the current build.
      Returns:
      - String representing the build result
      See Also:
      • getBuildResult(AbstractBuild)
    • getUpstreamBuildResult

      public String getUpstreamBuildResult()
      Determines the result of the upstream build.
      Returns:
      - String representing the build result
      See Also:
      • getBuildResult(AbstractBuild)
    • getUpstreamPipelineBuild

      public PipelineBuild getUpstreamPipelineBuild()
      Returns the upstream PipelineBuild object from the current PipelineBuild object.
      Returns:
      - Upstream PipelineBuild object from the current PipelineBuild object
    • getBuildDuration

      public String getBuildDuration()
      Returns the current build duration.
      Returns:
      - Current build duration or an empty String if the current build is null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBuildDescription

      public String getBuildDescription()
      Returns the current build description.
      Returns:
      - Current build description or the project name if the current build is null.
    • getBuildProgress

      public long getBuildProgress()
      Returns the estimated percentage complete of the current build.
      Returns:
      - Estimated percentage complete of the current build.
    • calculatePercentage

      protected long calculatePercentage(long duration, long estimatedDuration)
      Calculates percentage of the current duration to the estimated duration. Caters for the possibility that current duration will be longer than estimated duration
      Parameters:
      duration - - Current running time in milliseconds
      estimatedDuration - - Estimated running time in milliseconds
      Returns:
      - Percentage of current duration to estimated duration
    • getPipelineVersion

      public String getPipelineVersion()
      Return pipeline version which is simply the first build's number
      Returns:
      pipeline verison
    • hasBuildPermission

      public boolean hasBuildPermission()
      Checks whether the user has Build permission for the current project.
      Returns:
      - true: Has Build permission; false: Does not have Build permission
      See Also:
    • isReadyToBeManuallyBuilt

      public boolean isReadyToBeManuallyBuilt()
      Returns:
      is ready to be manually built.
    • isRerunnable

      public boolean isRerunnable()
    • isManualTrigger

      public boolean isManualTrigger()
      Determine if the project is triggered manually, regardless of the state of its upstream builds
      Returns:
      true if it is manual
    • getStartTime

      public Date getStartTime()
      Start time of build
      Returns:
      start time
    • getFormattedStartTime

      public String getFormattedStartTime()
      Returns:
      Formatted start time
    • getFormattedStartDate

      public String getFormattedStartDate()
      Returns:
      Formatted start date
    • isProjectDisabled

      public boolean isProjectDisabled()
    • getProjectHealth

      public String getProjectHealth()