public class GitBridge extends AbstractSCMBridge
Modifier and Type | Class and Description |
---|---|
static class |
GitBridge.DescriptorImpl
Descriptor implementation for GitBridge
|
integrationStrategy, LOG_PREFIX
Constructor and Description |
---|
GitBridge(IntegrationStrategy integrationStrategy,
String integrationBranch,
String repoName)
Constructor for GitBridge.
|
Modifier and Type | Method and Description |
---|---|
static void |
deleteBranch(hudson.model.Run<?,?> run,
hudson.model.TaskListener listener,
org.jenkinsci.plugins.gitclient.GitClient client,
String branchToBeDeleted,
String expandedRepo) |
void |
deleteIntegratedBranch(hudson.model.AbstractBuild<?,?> build,
hudson.model.TaskListener listener)
Deletes the integrated integrationBranch.
|
void |
ensureBranch(hudson.model.AbstractBuild<?,?> build,
hudson.Launcher launcher,
hudson.model.BuildListener listener,
String branch)
Make sure the SCM is checked out on the given integrationBranch.
|
void |
evalBranchConfigurations(hudson.plugins.git.Branch triggeredBranch,
String integrationBranch,
String repoName) |
protected hudson.plugins.git.GitSCM |
findScm(hudson.model.AbstractBuild<?,?> build,
hudson.model.TaskListener listener)
Returns the Git SCM for the relevant build data.
|
String |
getExpandedIntegrationBranch(hudson.EnvVars environment) |
String |
getExpandedRepository(hudson.EnvVars environment) |
String |
getIntegrationBranch()
Information about the result of the integration (Unknown, Conflict, Build, Push).
|
String |
getRepoName() |
hudson.FilePath |
getWorkingDirectory() |
void |
handleIntegrationExceptionsGit(hudson.model.Run run,
hudson.model.TaskListener listener,
Exception e,
org.jenkinsci.plugins.gitclient.GitClient client) |
void |
handlePostBuild(hudson.model.AbstractBuild<?,?> build,
hudson.Launcher launcher,
hudson.model.BuildListener listener)
Called after the build has run.
|
void |
isApplicable(hudson.model.AbstractBuild<?,?> build,
hudson.model.BuildListener listener)
Determines if we should prepare a workspace for integration.
|
static void |
pushToBranch(hudson.model.TaskListener listener,
org.jenkinsci.plugins.gitclient.GitClient client,
String branchToPush,
String expandedRepo) |
void |
pushToIntegrationBranch(hudson.model.AbstractBuild<?,?> build,
hudson.model.BuildListener listener)
Pushes changes to the integration integrationBranch.
|
static void |
pushToIntegrationBranchGit(hudson.model.Run<?,?> run,
hudson.model.TaskListener listener,
org.jenkinsci.plugins.gitclient.GitClient client,
String expandedRepo,
String expandedBranch) |
hudson.FilePath |
resolveWorkspace(hudson.model.AbstractBuild<?,?> build,
hudson.model.BuildListener listener)
Returns the workspace
|
void |
setRepoName(String repositoryName) |
void |
setWorkingDirectory(hudson.FilePath workingDirectory) |
protected void |
update(hudson.model.AbstractBuild<?,?> build,
hudson.model.BuildListener listener)
Pulls in the remote branch
|
void |
updateBuildDescription(hudson.model.AbstractBuild<?,?> build,
hudson.Launcher launcher,
hudson.model.BuildListener listener)
Updates the description of the Jenkins build.
|
static void |
updateBuildDescription(hudson.model.Run<?,?> run,
hudson.model.TaskListener listener,
String integrationBranch,
String triggeredBranch) |
void |
validateConfiguration(hudson.model.AbstractProject<?,?> project)
Validates the configuration of the Jenkins Job.
|
all, getBehaviours, getDescriptor, getDescriptors, getRequiredResult, handleIntegrationExceptions, mergeChanges, prepareWorkspace
@DataBoundConstructor public GitBridge(IntegrationStrategy integrationStrategy, String integrationBranch, String repoName)
integrationStrategy
- The selected IntegrationStrategyintegrationBranch
- The Integration Branch namerepoName
- The Integration Repository namepublic static void pushToIntegrationBranchGit(hudson.model.Run<?,?> run, hudson.model.TaskListener listener, org.jenkinsci.plugins.gitclient.GitClient client, String expandedRepo, String expandedBranch) throws PushFailedException
PushFailedException
public static void pushToBranch(hudson.model.TaskListener listener, org.jenkinsci.plugins.gitclient.GitClient client, String branchToPush, String expandedRepo) throws PushFailedException
PushFailedException
public static void deleteBranch(hudson.model.Run<?,?> run, hudson.model.TaskListener listener, org.jenkinsci.plugins.gitclient.GitClient client, String branchToBeDeleted, String expandedRepo) throws BranchDeletionFailedException, IOException
public static void updateBuildDescription(hudson.model.Run<?,?> run, hudson.model.TaskListener listener, String integrationBranch, String triggeredBranch)
protected hudson.plugins.git.GitSCM findScm(hudson.model.AbstractBuild<?,?> build, hudson.model.TaskListener listener) throws IOException, InterruptedException
build
- The Buildlistener
- The BuildListenerInterruptedException
- When no matching SCMs are foundNothingToDoException
- When no relevant BuildData is found.UnsupportedConfigurationException
- When multiple, ambiguous relevant BuildDatas are found.IOException
public void ensureBranch(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener, String branch) throws EstablishingWorkspaceFailedException
ensureBranch
in class AbstractSCMBridge
build
- The Buildlauncher
- The Launcherlistener
- The BuildListenerbranch
- The integrationBranch to check outEstablishingWorkspaceFailedException
- Used in case the branch cannot be checked outprotected void update(hudson.model.AbstractBuild<?,?> build, hudson.model.BuildListener listener) throws IOException, InterruptedException
build
- The Buildlistener
- The ListenerIOException
- An unforeseen IO issueInterruptedException
- An foreseen issuepublic void pushToIntegrationBranch(hudson.model.AbstractBuild<?,?> build, hudson.model.BuildListener listener) throws PushFailedException
pushToIntegrationBranch
in class AbstractSCMBridge
build
- The Buildlistener
- The BuildListenerPushFailedException
- Used in case of not being able to pushpublic void isApplicable(hudson.model.AbstractBuild<?,?> build, hudson.model.BuildListener listener) throws NothingToDoException, UnsupportedConfigurationException, IOException, InterruptedException
isApplicable
in class AbstractSCMBridge
build
- The Buildlistener
- The BuildListenerNothingToDoException
- Used in no git SCM data foundUnsupportedConfigurationException
- Used in case of ambiguous git data of the remote repoInterruptedException
- An unforeseen issueIOException
public void deleteIntegratedBranch(hudson.model.AbstractBuild<?,?> build, hudson.model.TaskListener listener) throws BranchDeletionFailedException, NothingToDoException, UnsupportedConfigurationException, IOException
deleteIntegratedBranch
in class AbstractSCMBridge
build
- The Abstractbuildlistener
- The BuildListenerBranchDeletionFailedException
- Used in case remote branch deletion failsNothingToDoException
UnsupportedConfigurationException
IOException
public void updateBuildDescription(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener) throws NothingToDoException, UnsupportedConfigurationException, IOException, InterruptedException
updateBuildDescription
in class AbstractSCMBridge
build
- The Buildlauncher
- The Launcherlistener
- The BuildListenerNothingToDoException
- Used in case the submitted commit is behind the integrationUnsupportedConfigurationException
- Mismatch in job configurationInterruptedException
- An unforeseen issueIOException
public hudson.FilePath resolveWorkspace(hudson.model.AbstractBuild<?,?> build, hudson.model.BuildListener listener) throws InterruptedException, IOException
build
- The Buildlistener
- The ListenerInterruptedException
- Unforeseen issueIOException
- Unforeseen IO issuepublic void validateConfiguration(hudson.model.AbstractProject<?,?> project) throws UnsupportedConfigurationException
validateConfiguration
in class AbstractSCMBridge
project
- The ProjectUnsupportedConfigurationException
- Mismatch in job configurationpublic void handlePostBuild(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener) throws IOException
handlePostBuild
in class AbstractSCMBridge
build
- The Buildlauncher
- The Launcherlistener
- The BuildListenerIOException
- A repository could not be reached.public String getIntegrationBranch()
getIntegrationBranch
in class AbstractSCMBridge
public String getExpandedIntegrationBranch(hudson.EnvVars environment)
getExpandedIntegrationBranch
in class AbstractSCMBridge
environment
- environmentpublic hudson.FilePath getWorkingDirectory()
public void setWorkingDirectory(hudson.FilePath workingDirectory)
workingDirectory
- the workingDirectory to setpublic String getRepoName()
@DataBoundSetter public void setRepoName(String repositoryName)
repositoryName
- the repositoryName to setpublic String getExpandedRepository(hudson.EnvVars environment)
environment
- the environement to look for stringspublic void evalBranchConfigurations(hudson.plugins.git.Branch triggeredBranch, String integrationBranch, String repoName) throws hudson.AbortException
triggeredBranch
- The triggered branchintegrationBranch
- The integration branchrepoName
- The repo name like 'origin'hudson.AbortException
- The triggered branch and the integration is the same - not allowedpublic void handleIntegrationExceptionsGit(hudson.model.Run run, hudson.model.TaskListener listener, Exception e, org.jenkinsci.plugins.gitclient.GitClient client) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2016–2018. All rights reserved.