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
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:
- fastForwardMode: The fast forward mode to use when pulling changes from the remote repo. Supported values are: FF, NO_FF, FF_ONLY. Default is FF.
- mergeStrategy: The merge strategy to use. Supported values are: ours, theirs, simple_two_way_in_core, resolve, recursive. Default is
theirs - contentMergeOption: The content merge strategy to handle conflicts. Supported values are CONFLICT, OURS, THEIRS, UNION. Default is
CONFLICT - 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
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected org.eclipse.jgit.merge.ContentMergeStrategyprotected static final Stringprotected org.eclipse.jgit.api.MergeCommand.FastForwardModeprotected static final Stringprotected org.eclipse.jgit.merge.MergeStrategyprotected static final Stringprotected StringFields 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, remoteRepoUrlFields inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
FAIL_DEPLOYMENT_CONFIG_KEY, failDeploymentOnFailureFields inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
alwaysRun, env, excludeFiles, includeFiles, JUMPING_TO_PARAM_NAME, jumpTo, label, name, siteName, targetId -
Constructor Summary
ConstructorsConstructorDescriptionGitPullProcessor(File localRepoFolder, org.craftercms.commons.git.utils.AuthConfiguratorFactory authConfiguratorFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcheckMergeResult(org.eclipse.jgit.api.MergeResult mergeResult) protected org.eclipse.jgit.api.Gitprotected voiddoClone(ProcessorExecution execution) protected voiddoInit(org.apache.commons.configuration2.Configuration config) Allows extending classes perform any custom initializationprotected ChangeSetdoMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) protected voiddoPull(ProcessorExecution execution) protected booleanIndicates if the deployment should be marked as failed if this processor throws an errorprotected booleanMethods inherited from class org.craftercms.deployer.impl.processors.git.AbstractRemoteGitRepoAwareProcessor
createAuthenticationConfigurator, doDestroy, openLocalRepository, shouldExecuteMethods inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
doExecute, initMethods inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
destroy, execute, getDeploymentParam, getFilteredChangeSet, isJumpToActive, isPostDeployment, setBeanName, setEnv, setSiteName, setTargetId, shouldIncludeFile, startJumpTo, supportsMode
-
Field Details
-
REMOTE_REPO_NAME_CONFIG_KEY
- See Also:
-
MERGE_STRATEGY_CONFIG_KEY
- See Also:
-
CONTENT_MERGE_STRATEGY_OPTION_CONFIG_KEY
- See Also:
-
FAST_FORWARD_MODE_CONFIG_KEY
- See Also:
-
remoteRepoName
-
mergeStrategy
protected org.eclipse.jgit.merge.MergeStrategy mergeStrategy -
contentMergeStrategy
protected org.eclipse.jgit.merge.ContentMergeStrategy contentMergeStrategy -
fastForwardMode
protected org.eclipse.jgit.api.MergeCommand.FastForwardMode fastForwardMode
-
-
Constructor Details
-
GitPullProcessor
public GitPullProcessor(File localRepoFolder, org.craftercms.commons.git.utils.AuthConfiguratorFactory authConfiguratorFactory)
-
-
Method Details
-
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException Description copied from class:AbstractDeploymentProcessorAllows extending classes perform any custom initialization- Overrides:
doInitin 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:AbstractMainDeploymentProcessorIndicates if the deployment should be marked as failed if this processor throws an error- Overrides:
failDeploymentOnProcessorFailurein classAbstractMainDeploymentProcessor
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException Description copied from class:AbstractMainDeploymentProcessorPerforms the actual work of processing the files in theChangeSet, it is also possible to return a newChangeSetto be used for the following processors in the pipeline- Specified by:
doMainProcessin 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
ChangeSetor null - Throws:
DeployerException- if there is any error processing theChangeSet
-
doPull
- Throws:
DeployerException
-
checkMergeResult
protected String checkMergeResult(org.eclipse.jgit.api.MergeResult mergeResult) throws DeployerException - Throws:
DeployerException
-
doClone
- Throws:
DeployerException
-
cloneRemoteRepository
- Throws:
DeployerException
-
isRepositoryCorrupted
-