Class PipelineBuild
java.lang.Object
au.com.centrumsystems.hudson.plugin.buildpipeline.PipelineBuild
- Author:
- Centrum Systems
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorPipelineBuild(AbstractBuild<?, ?> build) Convenience method to createPipelineBuildfrom a build.PipelineBuild(AbstractBuild<?, ?> build, AbstractProject<?, ?> project, AbstractBuild<?, ?> previousBuild) Creates a new PipelineBuild with currentBuild, project and upstreamBuild set.PipelineBuild(FreeStyleProject project) -
Method Summary
Modifier and TypeMethodDescriptionprotected longcalculatePercentage(long duration, long estimatedDuration) Calculates percentage of the current duration to the estimated duration.Returns the current build description.Returns the current build duration.longReturns the estimated percentage complete of the current build.Build a URL of the currentBuildAbstractBuild<?,?> Returns the current build number.Determines the result of the current build.Constructs a List of downstream PipelineBuild objects that make up the current pipeline.Return pipeline version which is simply the first build's numberAbstractProject<?,?> Returns the project name.Builds a URL of the current projectStart time of buildAbstractBuild<?,?> Determines the result of the upstream build.Returns the upstream PipelineBuild object from the current PipelineBuild object.booleanChecks whether the user has Build permission for the current project.booleanDetermine if the project is triggered manually, regardless of the state of its upstream buildsbooleanbooleanbooleanvoidsetCurrentBuild(AbstractBuild<?, ?> currentBuild) voidsetProject(AbstractProject<?, ?> currentProject) voidsetUpstreamBuild(AbstractBuild<?, ?> upstreamBuild) toString()
-
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 buildproject- - current projectpreviousBuild- - upstream build
-
PipelineBuild
Convenience method to createPipelineBuildfrom a build.- Parameters:
build- The object to be wrapped.
-
PipelineBuild
- Parameters:
project- project
-
-
Method Details
-
getCurrentBuild
-
setCurrentBuild
-
getUpstreamBuild
-
setUpstreamBuild
-
setProject
-
getProject
Returns the project name. If the current project is null the project name is determined using the current build.- Returns:
- - Project name
-
getCurrentBuildNumber
Returns the current build number.- Returns:
- - Current build number or empty String is the current build is null.
-
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
Build a URL of the currentBuild- Returns:
- URL of the currentBuild
-
getProjectURL
Builds a URL of the current project- Returns:
- URL - of the project
-
getCurrentBuildResult
Determines the result of the current build.- Returns:
- - String representing the build result
- See Also:
-
getBuildResult(AbstractBuild)
-
getUpstreamBuildResult
Determines the result of the upstream build.- Returns:
- - String representing the build result
- See Also:
-
getBuildResult(AbstractBuild)
-
getUpstreamPipelineBuild
Returns the upstream PipelineBuild object from the current PipelineBuild object.- Returns:
- - Upstream PipelineBuild object from the current PipelineBuild object
-
getBuildDuration
Returns the current build duration.- Returns:
- - Current build duration or an empty String if the current build is null.
-
toString
-
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
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
Start time of build- Returns:
- start time
-
getFormattedStartTime
- Returns:
- Formatted start time
-
getFormattedStartDate
- Returns:
- Formatted start date
-
isProjectDisabled
public boolean isProjectDisabled() -
getProjectHealth
-