public abstract class BuildChooser extends Object implements hudson.ExtensionPoint, hudson.model.Describable<BuildChooser>, Serializable
This object is persisted as a part of the project configuration.
| Modifier and Type | Field and Description |
|---|---|
GitSCM |
gitSCM
Refers back to the
GitSCM that owns this build chooser. |
| Constructor and Description |
|---|
BuildChooser() |
| Modifier and Type | Method and Description |
|---|---|
static hudson.DescriptorExtensionList<BuildChooser,BuildChooserDescriptor> |
all()
All the registered build choosers.
|
static List<BuildChooserDescriptor> |
allApplicableTo(hudson.model.Item item)
All the registered build choosers that are applicable to the specified item.
|
Collection<hudson.plugins.git.Revision> |
getCandidateRevisions(boolean isPollCall,
String singleBranch,
org.jenkinsci.plugins.gitclient.GitClient git,
hudson.model.TaskListener listener,
BuildData buildData,
BuildChooserContext context)
Get a list of revisions that are candidates to be built.
|
Collection<hudson.plugins.git.Revision> |
getCandidateRevisions(boolean isPollCall,
String singleBranch,
hudson.plugins.git.IGitAPI git,
hudson.model.TaskListener listener,
BuildData buildData)
Deprecated.
as of 1.1.17
Use and override
getCandidateRevisions(boolean, String, IGitAPI, TaskListener, BuildData, BuildChooserContext) |
Collection<hudson.plugins.git.Revision> |
getCandidateRevisions(boolean isPollCall,
String singleBranch,
hudson.plugins.git.IGitAPI git,
hudson.model.TaskListener listener,
BuildData buildData,
BuildChooserContext context)
Deprecated.
|
BuildChooserDescriptor |
getDescriptor() |
String |
getDisplayName()
Short-hand to get to the display name.
|
void |
prepareWorkingTree(org.jenkinsci.plugins.gitclient.GitClient git,
hudson.model.TaskListener listener,
BuildChooserContext context)
In a general case, a working tree is a left-over from the previous build, so it can be quite
messed up (such as HEAD pointing to a random branch).
|
Build |
prevBuildForChangelog(String branch,
BuildData data,
org.jenkinsci.plugins.gitclient.GitClient git,
BuildChooserContext context)
Determines the baseline to compute the changelog against.
|
Build |
prevBuildForChangelog(String branch,
BuildData data,
hudson.plugins.git.IGitAPI git)
Deprecated.
as of 1.1.25
Use and override
prevBuildForChangelog(String, BuildData, IGitAPI, BuildChooserContext) |
Build |
prevBuildForChangelog(String branch,
BuildData data,
hudson.plugins.git.IGitAPI git,
BuildChooserContext context)
Deprecated.
as of 1.2.0
Use and override
prevBuildForChangelog(String, BuildData, org.jenkinsci.plugins.gitclient.GitClient, BuildChooserContext) |
public transient GitSCM gitSCM
public final String getDisplayName()
public Collection<hudson.plugins.git.Revision> getCandidateRevisions(boolean isPollCall, String singleBranch, org.jenkinsci.plugins.gitclient.GitClient git, hudson.model.TaskListener listener, BuildData buildData, BuildChooserContext context) throws hudson.plugins.git.GitException, IOException, InterruptedException
This method is invoked on the node where the workspace exists, which may not be the master.
isPollCall - true if this method is called from pollChanges.singleBranch - contains the name of a single branch to be built
this will be non-null only in the simple case, in advanced
cases with multiple repositories and/or branches specified
then this value will be null.context - Object that provides access back to the model object. This is because
the build chooser can be invoked on a slave where there's no direct access
to the build/project for which this is invoked.
If isPollCall is false, then call back to both project and build are available.
If isPollCall is true, then only the callback to the project is available as there's
no contextual build object.IOExceptionhudson.plugins.git.GitExceptionInterruptedExceptionpublic Collection<hudson.plugins.git.Revision> getCandidateRevisions(boolean isPollCall, String singleBranch, hudson.plugins.git.IGitAPI git, hudson.model.TaskListener listener, BuildData buildData, BuildChooserContext context) throws hudson.plugins.git.GitException, IOException, InterruptedException
getCandidateRevisions(boolean, String, org.jenkinsci.plugins.gitclient.GitClient, hudson.model.TaskListener, BuildData, BuildChooserContext)hudson.plugins.git.GitExceptionIOExceptionInterruptedExceptionpublic Collection<hudson.plugins.git.Revision> getCandidateRevisions(boolean isPollCall, String singleBranch, hudson.plugins.git.IGitAPI git, hudson.model.TaskListener listener, BuildData buildData) throws hudson.plugins.git.GitException, IOException
getCandidateRevisions(boolean, String, IGitAPI, TaskListener, BuildData, BuildChooserContext)hudson.plugins.git.GitExceptionIOExceptionpublic Build prevBuildForChangelog(String branch, @Nullable BuildData data, hudson.plugins.git.IGitAPI git)
prevBuildForChangelog(String, BuildData, IGitAPI, BuildChooserContext)public Build prevBuildForChangelog(String branch, @Nullable BuildData data, org.jenkinsci.plugins.gitclient.GitClient git, BuildChooserContext context) throws IOException, InterruptedException
getCandidateRevisions(boolean, String, IGitAPI, TaskListener, BuildData, BuildChooserContext) determine
what commits can be subject for a build, and for each commit it determines the branches that contribute to them.
Once GitSCM picks up a specific Revision to build, for each branch,
in that revision, this method is called to compute the changelog.
branch - The branch name.data - Information that captures what we did during the last build.git - Used for invoking Gitcontext - Object that provides access back to the model object. This is because
the build chooser can be invoked on a slave where there's no direct access
to the build/project for which this is invoked.IOExceptionInterruptedExceptionpublic Build prevBuildForChangelog(String branch, @Nullable BuildData data, hudson.plugins.git.IGitAPI git, BuildChooserContext context) throws IOException, InterruptedException
prevBuildForChangelog(String, BuildData, org.jenkinsci.plugins.gitclient.GitClient, BuildChooserContext)IOExceptionInterruptedExceptionpublic BuildChooserDescriptor getDescriptor()
getDescriptor in interface hudson.model.Describable<BuildChooser>public static hudson.DescriptorExtensionList<BuildChooser,BuildChooserDescriptor> all()
public static List<BuildChooserDescriptor> allApplicableTo(hudson.model.Item item)
item - the item.@ParametersAreNonnullByDefault
public void prepareWorkingTree(org.jenkinsci.plugins.gitclient.GitClient git,
hudson.model.TaskListener listener,
BuildChooserContext context)
throws IOException,
InterruptedException
Typical use-case is a BuildChooser which do handle pull-request merge for validation. Such a
BuildChooser will run the merge on working copy, and expose the merge commit as
getCandidateRevisions(boolean, String, org.jenkinsci.plugins.gitclient.GitClient, hudson.model.TaskListener, BuildData, BuildChooserContext)
git - client to execute git commands on working treelistener - build logcontext - back-channel to master so implementation can interact with Jenkins modelIOExceptionInterruptedExceptionCopyright © 2004-2015. All Rights Reserved.