Class PipelineBuild
- java.lang.Object
-
- au.com.centrumsystems.hudson.plugin.buildpipeline.PipelineBuild
-
public class PipelineBuild extends Object
- Author:
- Centrum Systems
-
-
Constructor Summary
Constructors Constructor Description PipelineBuild()
Default constructorPipelineBuild(AbstractBuild<?,?> build)
Convenience method to createPipelineBuild
from a build.PipelineBuild(AbstractBuild<?,?> build, AbstractProject<?,?> project, AbstractBuild<?,?> previousBuild)
Creates a new PipelineBuild with currentBuild, project and upstreamBuild set.PipelineBuild(FreeStyleProject project)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
calculatePercentage(long duration, long estimatedDuration)
Calculates percentage of the current duration to the estimated duration.String
getBuildDescription()
Returns the current build description.String
getBuildDuration()
Returns the current build duration.long
getBuildProgress()
Returns the estimated percentage complete of the current build.String
getBuildResultURL()
Build a URL of the currentBuildAbstractBuild<?,?>
getCurrentBuild()
String
getCurrentBuildNumber()
Returns the current build number.String
getCurrentBuildResult()
Determines the result of the current build.List<PipelineBuild>
getDownstreamPipeline()
Constructs a List of downstream PipelineBuild objects that make up the current pipeline.String
getFormattedStartDate()
String
getFormattedStartTime()
String
getPipelineVersion()
Return pipeline version which is simply the first build's numberAbstractProject<?,?>
getProject()
Returns the project name.String
getProjectHealth()
String
getProjectURL()
Builds a URL of the current projectDate
getStartTime()
Start time of buildAbstractBuild<?,?>
getUpstreamBuild()
String
getUpstreamBuildResult()
Determines the result of the upstream build.PipelineBuild
getUpstreamPipelineBuild()
Returns the upstream PipelineBuild object from the current PipelineBuild object.boolean
hasBuildPermission()
Checks whether the user has Build permission for the current project.boolean
isManualTrigger()
Determine if the project is triggered manually, regardless of the state of its upstream buildsboolean
isProjectDisabled()
boolean
isReadyToBeManuallyBuilt()
boolean
isRerunnable()
void
setCurrentBuild(AbstractBuild<?,?> currentBuild)
void
setProject(AbstractProject<?,?> currentProject)
void
setUpstreamBuild(AbstractBuild<?,?> upstreamBuild)
String
toString()
-
-
-
Constructor Detail
-
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 buildproject
- - current projectpreviousBuild
- - upstream build
-
PipelineBuild
public PipelineBuild(AbstractBuild<?,?> build)
Convenience method to createPipelineBuild
from a build.- Parameters:
build
- The object to be wrapped.
-
PipelineBuild
public PipelineBuild(FreeStyleProject project)
- Parameters:
project
- project
-
-
Method Detail
-
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.
-
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 millisecondsestimatedDuration
- - 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:
Item
-
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()
-
-