Class GitPullProcessor
- java.lang.Object
-
- org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.git.AbstractRemoteGitRepoAwareProcessor
-
- org.craftercms.deployer.impl.processors.git.GitPullProcessor
-
- All Implemented Interfaces:
DeploymentProcessor
,InitializableByConfigBean
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
public class GitPullProcessor extends AbstractRemoteGitRepoAwareProcessor
Processor that clones/pulls a remote Git repository into a local path in the filesystem. A processor instance can be configured with the following YAML properties:- remoteRepo.url: The URL of the remote Git repo to pull.
- remoteRepo.name: The name to use for the remote repo when pulling from it (origin by default).
- remoteRepo.branch: The branch of the remote Git repo to pull.
- remoteRepo.username: The username for authentication with the remote Git repo. Not needed when SSH with RSA key pair authentication is used.
- remoteRepo.password: The password for authentication with the remote Git repo. Not needed when SSH with RSA key pair authentication is used.
- remoteRepo.ssh.privateKey.path: The SSH private key path, used only with SSH with RSA key pair authentication.
- remoteRepo.ssh.privateKey.passphrase: The SSH private key passphrase, used only with SSH withRSA key pair authentication.
- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
REMOTE_REPO_NAME_CONFIG_KEY
protected String
remoteRepoName
-
Fields inherited from class org.craftercms.deployer.impl.processors.git.AbstractRemoteGitRepoAwareProcessor
authConfiguratorFactory, authenticationConfigurator, localRepoFolder, REMOTE_REPO_BRANCH_CONFIG_KEY, REMOTE_REPO_PASSWORD_CONFIG_KEY, REMOTE_REPO_SSH_PRV_KEY_PASSPHRASE_CONFIG_KEY, REMOTE_REPO_SSH_PRV_KEY_PATH_CONFIG_KEY, REMOTE_REPO_URL_CONFIG_KEY, REMOTE_REPO_USERNAME_CONFIG_KEY, remoteRepoBranch, remoteRepoUrl
-
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
FAIL_DEPLOYMENT_CONFIG_KEY, failDeploymentOnFailure
-
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
alwaysRun, env, excludeFiles, includeFiles, JUMPING_TO_PARAM_NAME, jumpTo, label, name, siteName, targetId
-
-
Constructor Summary
Constructors Constructor Description GitPullProcessor(File localRepoFolder, org.craftercms.commons.git.utils.AuthConfiguratorFactory authConfiguratorFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkMergeResult(org.eclipse.jgit.api.MergeResult mergeResult)
protected org.eclipse.jgit.api.Git
cloneRemoteRepository()
protected void
doClone(ProcessorExecution execution)
protected void
doInit(org.apache.commons.configuration2.Configuration config)
Allows extending classes perform any custom initializationprotected ChangeSet
doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet)
protected void
doPull(ProcessorExecution execution)
protected boolean
failDeploymentOnProcessorFailure()
Indicates if the deployment should be marked as failed if this processor throws an error-
Methods inherited from class org.craftercms.deployer.impl.processors.git.AbstractRemoteGitRepoAwareProcessor
createAuthenticationConfigurator, doDestroy, openLocalRepository, shouldExecute
-
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
doExecute, init
-
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
destroy, execute, getFilteredChangeSet, isJumpToActive, isPostDeployment, setBeanName, setEnv, setSiteName, setTargetId, shouldIncludeFile, startJumpTo, supportsMode
-
-
-
-
Field Detail
-
REMOTE_REPO_NAME_CONFIG_KEY
protected static final String REMOTE_REPO_NAME_CONFIG_KEY
- See Also:
- Constant Field Values
-
remoteRepoName
protected String remoteRepoName
-
-
Constructor Detail
-
GitPullProcessor
public GitPullProcessor(File localRepoFolder, org.craftercms.commons.git.utils.AuthConfiguratorFactory authConfiguratorFactory)
-
-
Method Detail
-
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException
Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom initialization- Overrides:
doInit
in classAbstractRemoteGitRepoAwareProcessor
- Parameters:
config
- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException
- if there's configuration related exception
-
failDeploymentOnProcessorFailure
protected boolean failDeploymentOnProcessorFailure()
Description copied from class:AbstractMainDeploymentProcessor
Indicates if the deployment should be marked as failed if this processor throws an error- Overrides:
failDeploymentOnProcessorFailure
in classAbstractMainDeploymentProcessor
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException
Description copied from class:AbstractMainDeploymentProcessor
Performs the actual work of processing the files in theChangeSet
, it is also possible to return a newChangeSet
to be used for the following processors in the pipeline- Specified by:
doMainProcess
in classAbstractMainDeploymentProcessor
- Parameters:
deployment
- the current deploymentexecution
- the current executionfilteredChangeSet
- the filtered change set (as returned byAbstractDeploymentProcessor.getFilteredChangeSet(ChangeSet)
)originalChangeSet
- the original change set (as returned by the previous processors in the pipeline)- Returns:
- a new
ChangeSet
or null - Throws:
DeployerException
- if there is any error processing theChangeSet
-
doPull
protected void doPull(ProcessorExecution execution) throws DeployerException
- Throws:
DeployerException
-
checkMergeResult
protected String checkMergeResult(org.eclipse.jgit.api.MergeResult mergeResult) throws DeployerException
- Throws:
DeployerException
-
doClone
protected void doClone(ProcessorExecution execution) throws DeployerException
- Throws:
DeployerException
-
cloneRemoteRepository
protected org.eclipse.jgit.api.Git cloneRemoteRepository() throws DeployerException
- Throws:
DeployerException
-
-