public abstract class BuildCardExtension extends hudson.model.AbstractDescribableImpl<BuildCardExtension> implements hudson.ExtensionPoint, Comparable<BuildCardExtension>
This class is an extension point for a plugin to provide their own behavior for the 'build cards' that show up in the build pipeline plugin.
This base class encapsulates the logic for how builds can be re-run and how the upstream build is found, allowing subclasses to override this behavior.
In addition, this class also defines the look-and-feel of the build cards so that they can be overridden. These are defined in the following .jelly files:
Constructor and Description |
---|
BuildCardExtension() |
Modifier and Type | Method and Description |
---|---|
static hudson.ExtensionList<BuildCardExtension> |
all() |
int |
compareTo(BuildCardExtension o) |
protected List<hudson.model.Action> |
filterActions(List<hudson.model.Action> actions)
Filter out the list of actions so that it only includes
ParametersAction and
CauseActions, removing the UserIdAction from the CauseAction's list of Causes. |
protected hudson.model.CauseAction |
filterOutUserIdCause(hudson.model.CauseAction causeAction)
Filter out
Cause.UserIdCause from the given CauseAction . |
abstract long |
getIndex()
Return an index to where this should be displayed, relative to other options
|
protected static hudson.model.ParametersAction |
mergeParameters(hudson.model.ParametersAction base,
hudson.model.ParametersAction overlay)
From parameterized trigger plugin src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java
|
int |
rerunBuild(String externalizableId)
Re-run the build known by the given Run externalizeableId
|
protected hudson.model.AbstractBuild<?,?> |
retrieveBuild(int buildNo,
hudson.model.AbstractProject<?,?> project)
Given an AbstractProject and a build number the associated AbstractBuild will be retrieved.
|
protected List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> |
retrieveUpstreamProjectTriggerConfig(hudson.model.AbstractProject<?,?> project,
hudson.model.AbstractBuild<?,?> upstreamBuild)
Used to retrieve the parameters from the upstream project build trigger relative to the given downstream project
|
protected int |
triggerBuild(hudson.model.AbstractProject<?,?> triggerProject,
hudson.model.AbstractBuild<?,?> upstreamBuild,
hudson.model.Action buildParametersAction)
Schedules a build to start.
|
int |
triggerManualBuild(hudson.model.ItemGroup pipelineContext,
Integer upstreamBuildNumber,
String triggerProjectName,
String upstreamProjectName)
Trigger a manual build
|
public static hudson.ExtensionList<BuildCardExtension> all()
BuildCardExtension
spublic abstract long getIndex()
public int compareTo(BuildCardExtension o)
compareTo
in interface Comparable<BuildCardExtension>
public int rerunBuild(String externalizableId)
externalizableId
- - a Run externalizableIdprotected List<hudson.model.Action> filterActions(List<hudson.model.Action> actions)
ParametersAction
and
CauseActions, removing the UserIdAction from the CauseAction's list of Causes.
We want to include CauseAction because that includes upstream cause actions, which
are inherited in downstream builds.
We do not want to inherit the UserId cause, because the user initiating a retry may
be different than the user who originated the upstream build, and so should be
re-identified.
We do not want to inherit any other CauseAction because that will result in duplicating
actions from publishers, and builders from previous builds corrupting the retriggered build.actions
- a collection of build actions.protected hudson.model.CauseAction filterOutUserIdCause(hudson.model.CauseAction causeAction)
Cause.UserIdCause
from the given CauseAction
.
We want to do this because re-run will want to contribute its own
Cause.UserIdCause
, not copy it from the previous run.causeAction
- the causeAction to remove UserIdCause frompublic int triggerManualBuild(hudson.model.ItemGroup pipelineContext, Integer upstreamBuildNumber, String triggerProjectName, String upstreamProjectName)
pipelineContext
- - the context of the calling pipeline, used to find projects in the pipelineupstreamBuildNumber
- - the build number of the upstream buildtriggerProjectName
- - the name of the project being manually triggeredupstreamProjectName
- - the name of the project in the upstream buildprotected int triggerBuild(hudson.model.AbstractProject<?,?> triggerProject, hudson.model.AbstractBuild<?,?> upstreamBuild, hudson.model.Action buildParametersAction)
triggerProject
- - Schedule a build to start on this AbstractProjectupstreamBuild
- - The upstream AbstractBuild that will be used as a Cause for the triggerProject's build.buildParametersAction
- - The upstream ParametersAction that will be used as an Action for the triggerProject's build.protected List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> retrieveUpstreamProjectTriggerConfig(hudson.model.AbstractProject<?,?> project, hudson.model.AbstractBuild<?,?> upstreamBuild)
project
- the downstream projectupstreamBuild
- the upstream project buildprotected static hudson.model.ParametersAction mergeParameters(hudson.model.ParametersAction base, hudson.model.ParametersAction overlay)
base
- One of the two parameters to merge.overlay
- The other parameters to mergeprotected hudson.model.AbstractBuild<?,?> retrieveBuild(int buildNo, hudson.model.AbstractProject<?,?> project)
buildNo
- - Build numberproject
- - AbstractProjectCopyright © 2004–2017. All rights reserved.