Package com.atlassian.bamboo.plugins.git
Class GitRepository
-
- All Implemented Interfaces:
SharedCredentialDepender
,ConvertibleFromConfig
,InitablePluginModule
,GitRepositoryFacade
,AdvancedConfigurationAwareRepository
,BranchAwareRepository
,BranchDetectionCapableRepository
,BranchInformationProvider
,BranchMergingAwareRepository
,CacheHandler
,CachingAwareRepository
,CheckoutCustomRevisionDataAwareRepository
,CustomVariableProviderRepository
,DeploymentAwareRepository
,FilterChangesetAwareRepository
,IncludeExcludeAwareRepository
,MavenPomAccessorCapableRepository
,OnceOffCapableRepository
,PushCapableRepository
,QuietPeriodAwareRepository
,Repository
,ScmTypePublishingRepository
,SelectableAuthenticationRepository
,StandaloneRepository
,TestConnectionAwareRepository
,EditActionAwareRepository
,UniqueRevisionIdRepository
,DescriptionProvider
,NameProvider
,BambooPluginModule
,BuildConfigurationAwarePlugin
,ConfigurablePlugin
,RenderableBuildConfiguration
,CustomSourceDirectoryAwareRepository
,RepositoryV2
,RequirementsAwareRepository
,Serializable
public class GitRepository extends AbstractStandaloneRepository implements AdvancedConfigurationAwareRepository, BranchInformationProvider, BranchMergingAwareRepository, CacheHandler, CachingAwareRepository, CheckoutCustomRevisionDataAwareRepository, CustomSourceDirectoryAwareRepository, CustomVariableProviderRepository, DeploymentAwareRepository, GitRepositoryFacade, MavenPomAccessorCapableRepository, PushCapableRepository, RequirementsAwareRepository, SelectableAuthenticationRepository, SharedCredentialDepender, UniqueRevisionIdRepository, TestConnectionAwareRepository, ScmTypePublishingRepository, EditActionAwareRepository
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bamboo.repository.CachingAwareRepository
CachingAwareRepository.CachableOperation
-
-
Field Summary
-
Fields inherited from class com.atlassian.bamboo.repository.AbstractRepository
administrationConfigurationAccessor, BUILD_TRIGGER_IP, buildDirectoryManager, buildLoggerManager, customVariableContext, featureManager, REPO_PREFIX, repositoryModuleDescriptor, templateRenderer, textProvider
-
Fields inherited from class com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin
moduleDescriptor
-
Fields inherited from interface com.atlassian.bamboo.repository.FilterChangesetAwareRepository
CHANGESET_FILTER_PATTERN_REGEX, MAVEN_RELEASE_PLUGIN_EXCLUSION_PATTERN
-
Fields inherited from interface com.atlassian.bamboo.plugins.git.GitRepositoryFacade
GIT_REPOSITORIES_OF_PLAN
-
Fields inherited from interface com.atlassian.bamboo.repository.IncludeExcludeAwareRepository
FILTER_PATTERN_EXCLUDE, FILTER_PATTERN_INCLUDE, FILTER_PATTERN_NONE, FILTER_PATTERN_OPTION, FILTER_PATTERN_REGEX
-
Fields inherited from interface com.atlassian.bamboo.repository.Repository
SELECTED_REPOSITORY, UNKNOWN_HOST
-
Fields inherited from interface com.atlassian.bamboo.repository.TestConnectionAwareRepository
HOST_KEY
-
-
Constructor Summary
Constructors Constructor Description GitRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDefaultValues(@NotNull BuildConfiguration buildConfiguration)
Extension point for adding default values to the form forRenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)
void
beforeEditPageRendering(@NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
Action to be taken before rendering the edit page.ErrorCollection
beforeSave(@NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
Action to be taken before repository is saved from the UI.@NotNull BuildRepositoryChanges
collectChangesForRevision(@NotNull PlanKey planKey, @NotNull String targetRevision)
Collects the changes for the targetRevision.@NotNull BuildRepositoryChanges
collectChangesSinceLastBuild(@NotNull String planKey, @Nullable String lastVcsRevisionKey)
Collects the changes since the lastVcsRevisionKey.@NotNull BuildRepositoryChanges
collectChangesSinceLastBuild(@NotNull String planKey, @Nullable String lastVcsRevisionKey, @Nullable String customRevision)
@NotNull String
commit(@NotNull File sourceDirectory, @NotNull String message)
Perform a commit (dvcs commit).void
deleteCaches(@NotNull Collection<String> strings, @NotNull com.opensymphony.xwork.ValidationAware validationAware)
Delete the specified caches, handling internal data updates etc.void
deleteUnusedCaches(@NotNull com.opensymphony.xwork.ValidationAware validationAware)
Delete all unused caches.GitRepositoryAccessData
getAccessData()
@NotNull List<NameValuePair>
getAuthenticationTypes()
List all authentication types supported by repository.String
getAuthType()
String
getAuthTypeName()
@NotNull Collection<CacheDescription>
getCacheDescriptions()
Collection of cache descriptions to be displayed in the admin UI.File
getCacheDirectory()
File
getCacheDirectory(GitRepositoryAccessData accessData)
CacheId
getCacheId(@NotNull CachingAwareRepository.CachableOperation cachableOperation)
Cache id has to fulfill the following: Given two Repository objects A and B, returning equal CacheId (in terms of equals()) and a cachable operation foo(), in the following sequence of calls made in a short time period: 1.int
getCommandTimeout()
@NotNull Map<String,String>
getCustomVariables()
Return a map containing name->value mapping of the variables.CommitContext
getFirstCommit()
Retrieve the commit that created the Branch.@Nullable String
getGitCapability()
@Nullable GitRepository
getGitRepository()
@NotNull String
getHandlerDescription()
Additional information about this cache type that would be displayed in UI.String
getHost()
What's the repository server hostCommitContext
getLastCommit()
Retrieve last commit on the branch set on this Repository.@NotNull String
getLocationIdentifier()
A string representing the location of the repository@NotNull MavenPomAccessor
getMavenPomAccessor()
@NotNull String
getName()
The display name for the repository type@NotNull List<VcsBranch>
getOpenBranches(@Nullable String context)
Set
of open branches that are discovered in the repository.String
getOptionDescription()
@NotNull List<NameValuePair>
getPasswordCredentialsSources()
@NotNull List<NameValuePair>
getPasswordSharedCredentials()
@NotNull Map<String,String>
getPlanRepositoryVariables()
Return a map containing name->value mapping of the plan repository format variables.String
getRepositoryUrl()
@NotNull Set<Requirement>
getRequirements()
@NotNull String
getScm()
Get a string representing the name of the repository type.@NotNull Iterable<Long>
getSharedCredentialIds()
Returns a list of shared credential ids used by this class.@Nullable String
getSshCapability()
@NotNull List<NameValuePair>
getSshCredentialsSources()
@NotNull List<NameValuePair>
getSshSharedCredentials()
@NotNull VcsBranch
getVcsBranch()
boolean
getVerboseLogs()
boolean
isCachingSupportedFor(@NotNull CachingAwareRepository.CachableOperation cachableOperation)
boolean
isLfs()
boolean
isMergingSupported()
protected boolean
isOnLocalAgent()
boolean
isRepositoryDifferent(@NotNull Repository repository)
Checks if the current repo is the same as the given repositoryboolean
isSharedCredentialsDeleted()
boolean
isUseShallowClones()
boolean
isUseSubmodules()
boolean
mergeWorkspaceWith(@NotNull BuildContext buildContext, @NotNull File workspaceDir, @NotNull String targetRevision)
Merges a workspace located in checkout directory with the target revision.void
populateFromConfig(@NotNull org.apache.commons.configuration.HierarchicalConfiguration config)
Update the current object with data in theHierarchicalConfiguration
void
prepareConfigObject(@NotNull BuildConfiguration buildConfiguration)
Do any preprocessing work before validation occurs.void
pushRevision(@NotNull File sourceDirectory, @Nullable String vcsRevisionKey)
Push the specified revision to the remote directory.@NotNull String
retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable PlanVcsRevisionData planVcsRevisionData, @NotNull File sourceDirectory, int depth)
@NotNull String
retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable String vcsRevisionKey, @NotNull File sourceDirectory)
Checks out the latest source code from an appropriate repository to specified directory@NotNull String
retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable String vcsRevisionKey, @NotNull File sourceDirectory, int depth)
Checks out the latest source code from an appropriate repository to specified directoryvoid
setAccessData(GitRepositoryAccessData accessData)
void
setAgentContext(AgentContext agentContext)
void
setBranchIntegrationHelper(VcsBranchIntegrationHelper branchIntegrationHelper)
void
setCapabilityContext(CapabilityContext capabilityContext)
void
setCredentialsAccessor(CredentialsAccessor credentialsAccessor)
void
setGitCacheHandler(GitCacheHandler gitCacheHandler)
void
setI18nResolver(com.atlassian.sal.api.message.I18nResolver i18nResolver)
void
setSshProxyService(SshProxyService sshProxyService)
void
setTemplateRenderer(TemplateRenderer templateRenderer)
void
setTrustedKeyHelper(TrustedKeyHelper trustedKeyHelper)
void
setVcsBranch(@NotNull VcsBranch branch)
Set and prepare the repository for using an arbitrary branch.@NotNull ErrorCollection
testConnection(long timeout, @NotNull TimeUnit unit)
Test connection to the repository within the given timeout.@NotNull org.apache.commons.configuration.HierarchicalConfiguration
toConfiguration()
Generate aHierarchicalConfiguration
from the current state of the objectboolean
usePollingForBranchDetection()
If Bamboo generic detection polling should be used for this repository@NotNull ErrorCollection
validate(@NotNull BuildConfiguration buildConfiguration)
Validates the properties in theBuildConfiguration
object.@NotNull ErrorCollection
validateForConnectionTesting(@NotNull BuildConfiguration configuration)
A method similar toBuildConfigurationAwarePlugin.validate(BuildConfiguration)
used to validate repository configuration before connection testing.-
Methods inherited from class com.atlassian.bamboo.repository.AbstractStandaloneRepository
getAdvancedEditHtml, getAdvancedViewHtml, getEditHtml, getViewHtml, getViewHtml
-
Methods inherited from class com.atlassian.bamboo.repository.AbstractRepository
checkConnection, customizeBuildRequirements, getAdvancedEditHtml, getAdvancedViewHtml, getBranchIntegrationEditHtml, getChangesetFilterPatternRegex, getDefaultTriggerModule, getDescription, getEditHtml, getFilterFilePatternOption, getFilterFilePatternRegex, getKey, getMavenPomCheckoutAccessEditHtml, getMaxCommitsToReturn, getMaxRetries, getMinimalEditHtml, getPollingTriggerModule, getQuietPeriod, getShortKey, getSourceCodeDirectory, getSystemWideExclusionPatterns, getViewHtml, getWorkingDirectory, init, isAdvancedOptionEnabled, isQuietPeriodEnabled, isWorkspaceEmpty, removeBuildRequirements, setAdministrationConfigurationAccessor, setBuildDirectoryManager, setBuildLoggerManager, setChangesetFilterPatternRegex, setCustomVariableContext, setFeatureManager, setFilterFilePatternOption, setFilterFilePatternRegex, setTextProvider, setWorkingDir, substituteString, toMergeCapableRepository
-
Methods inherited from class com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin
getTemplateRenderer, populateContextForEdit, populateContextForView
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.repository.AdvancedConfigurationAwareRepository
getAdvancedEditHtml, getAdvancedViewHtml
-
Methods inherited from interface com.atlassian.bamboo.repository.BranchMergingAwareRepository
getBranchIntegrationEditHtml
-
Methods inherited from interface com.atlassian.bamboo.v2.build.BuildConfigurationAwarePlugin
isConfigurationMissing
-
Methods inherited from interface com.atlassian.bamboo.repository.CacheHandler
getKey
-
Methods inherited from interface com.atlassian.bamboo.v2.build.ConfigurablePlugin
customizeBuildRequirements, removeBuildRequirements
-
Methods inherited from interface com.atlassian.bamboo.utils.DescriptionProvider
getDescription
-
Methods inherited from interface com.atlassian.bamboo.plugin.InitablePluginModule
init
-
Methods inherited from interface com.atlassian.bamboo.v2.build.RenderableBuildConfiguration
getEditHtml, getViewHtml
-
Methods inherited from interface com.atlassian.bamboo.repository.Repository
checkConnection, getKey, getMinimalEditHtml, getShortKey
-
Methods inherited from interface com.atlassian.bamboo.v2.build.repository.RepositoryV2
getSourceCodeDirectory
-
-
-
-
Field Detail
-
DEFAULT_BRANCH
public static final String DEFAULT_BRANCH
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_REPOSITORY_URL
public static final String REPOSITORY_GIT_REPOSITORY_URL
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_AUTHENTICATION_TYPE
public static final String REPOSITORY_GIT_AUTHENTICATION_TYPE
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_SSH_CREDENTIALS_SOURCE
public static final String REPOSITORY_GIT_SSH_CREDENTIALS_SOURCE
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_PASSWORD_CREDENTIALS_SOURCE
public static final String REPOSITORY_GIT_PASSWORD_CREDENTIALS_SOURCE
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_USERNAME
public static final String REPOSITORY_GIT_USERNAME
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_PASSWORD
public static final String REPOSITORY_GIT_PASSWORD
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_BRANCH
public static final String REPOSITORY_GIT_BRANCH
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_SSH_KEY
public static final String REPOSITORY_GIT_SSH_KEY
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_SSH_PASSPHRASE
public static final String REPOSITORY_GIT_SSH_PASSPHRASE
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_USE_SHALLOW_CLONES
public static final String REPOSITORY_GIT_USE_SHALLOW_CLONES
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_USE_REMOTE_AGENT_CACHE
public static final String REPOSITORY_GIT_USE_REMOTE_AGENT_CACHE
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_USE_SUBMODULES
public static final String REPOSITORY_GIT_USE_SUBMODULES
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_MAVEN_PATH
public static final String REPOSITORY_GIT_MAVEN_PATH
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_COMMAND_TIMEOUT
public static final String REPOSITORY_GIT_COMMAND_TIMEOUT
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_VERBOSE_LOGS
public static final String REPOSITORY_GIT_VERBOSE_LOGS
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_FETCH_WHOLE_REPOSITORY
public static final String REPOSITORY_GIT_FETCH_WHOLE_REPOSITORY
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_LFS_REPOSITORY
public static final String REPOSITORY_GIT_LFS_REPOSITORY
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_SSH_SHAREDCREDENTIALS_ID
public static final String REPOSITORY_GIT_SSH_SHAREDCREDENTIALS_ID
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_PASSWORD_SHAREDCREDENTIALS_ID
public static final String REPOSITORY_GIT_PASSWORD_SHAREDCREDENTIALS_ID
- See Also:
- Constant Field Values
-
REPOSITORY_GIT_SHAREDCREDENTIALS_DELETED
public static final String REPOSITORY_GIT_SHAREDCREDENTIALS_DELETED
- See Also:
- Constant Field Values
-
USE_SHALLOW_CLONES
protected static boolean USE_SHALLOW_CLONES
-
-
Method Detail
-
getName
@NotNull public @NotNull String getName()
Description copied from interface:Repository
The display name for the repository type- Specified by:
getName
in interfaceCacheHandler
- Specified by:
getName
in interfaceDescriptionProvider
- Specified by:
getName
in interfaceNameProvider
- Specified by:
getName
in interfaceRepository
- Returns:
- name for the supported cache type
-
getScm
@NotNull public @NotNull String getScm()
Description copied from interface:ScmTypePublishingRepository
Get a string representing the name of the repository type. (e.g. "git")- Specified by:
getScm
in interfaceScmTypePublishingRepository
- Returns:
- a string representing the name of the repository type. (e.g. "git")
-
getHost
public String getHost()
Description copied from interface:Repository
What's the repository server host- Specified by:
getHost
in interfaceRepository
- Returns:
- The host!
-
isRepositoryDifferent
public boolean isRepositoryDifferent(@NotNull @NotNull Repository repository)
Description copied from interface:RepositoryV2
Checks if the current repo is the same as the given repository- Specified by:
isRepositoryDifferent
in interfaceRepositoryV2
- Parameters:
repository
- to compare against- Returns:
- true of repositories are different, false if the same;
-
collectChangesForRevision
@NotNull public @NotNull BuildRepositoryChanges collectChangesForRevision(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull String targetRevision) throws RepositoryException
Description copied from interface:OnceOffCapableRepository
Collects the changes for the targetRevision. This method is called only on server side (never on agent).- Specified by:
collectChangesForRevision
in interfaceOnceOffCapableRepository
- Overrides:
collectChangesForRevision
in classAbstractRepository
- Returns:
- A build changes object with the appropriate build changes (that is - with the single commit data relevant for targetRevision)
- Throws:
RepositoryException
- if something goes wrong
-
collectChangesSinceLastBuild
@NotNull public @NotNull BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull @NotNull String planKey, @Nullable @Nullable String lastVcsRevisionKey) throws RepositoryException
Description copied from interface:RepositoryV2
Collects the changes since the lastVcsRevisionKey. This method is called only on server side (never on agent).- Specified by:
collectChangesSinceLastBuild
in interfaceRepositoryV2
lastVcsRevisionKey
- can be null, if null you should ensure the correct vcsrevisionkey is returned in the BuildChanges object.- Returns:
- A build changes object with the appropriate build changes
- Throws:
RepositoryException
- if something goes wrong
-
collectChangesSinceLastBuild
@NotNull public @NotNull BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull @NotNull String planKey, @Nullable @Nullable String lastVcsRevisionKey, @Nullable @Nullable String customRevision) throws RepositoryException
- Throws:
RepositoryException
-
retrieveSourceCode
@NotNull public @NotNull String retrieveSourceCode(@NotNull @NotNull BuildContext buildContext, @Nullable @Nullable String vcsRevisionKey, @NotNull @NotNull File sourceDirectory) throws RepositoryException
Description copied from interface:CustomSourceDirectoryAwareRepository
Checks out the latest source code from an appropriate repository to specified directory- Specified by:
retrieveSourceCode
in interfaceCustomSourceDirectoryAwareRepository
vcsRevisionKey
- - may be null if you want latest codesourceDirectory
- - directory to checkout to- Returns:
- vcsRevisionKey - the revision
- Throws:
RepositoryException
-
retrieveSourceCode
@NotNull public @NotNull String retrieveSourceCode(@NotNull @NotNull BuildContext buildContext, @Nullable @Nullable String vcsRevisionKey, @NotNull @NotNull File sourceDirectory, int depth) throws RepositoryException
Description copied from interface:BranchMergingAwareRepository
Checks out the latest source code from an appropriate repository to specified directory- Specified by:
retrieveSourceCode
in interfaceBranchMergingAwareRepository
vcsRevisionKey
- - may be null if you want latest codesourceDirectory
- - directory to checkout todepth
- - how many historical revisions we'd like to check out (-1 means all revisions)- Returns:
- vcsRevisionKey - the revision
- Throws:
RepositoryException
-
retrieveSourceCode
@NotNull public @NotNull String retrieveSourceCode(@NotNull @NotNull BuildContext buildContext, @Nullable @Nullable PlanVcsRevisionData planVcsRevisionData, @NotNull @NotNull File sourceDirectory, int depth) throws RepositoryException
- Specified by:
retrieveSourceCode
in interfaceCheckoutCustomRevisionDataAwareRepository
- Throws:
RepositoryException
-
isOnLocalAgent
@TestOnly protected boolean isOnLocalAgent()
-
getOpenBranches
@NotNull public @NotNull List<VcsBranch> getOpenBranches(@Nullable @Nullable String context) throws RepositoryException
Description copied from interface:BranchDetectionCapableRepository
Set
of open branches that are discovered in the repository. Returns empty collection if no branches at all (can that happen?). Used for monitoring repositories for new branches. An open branch is a branch that is considered 'open' by underlying VCS - it has nothing to do with the actual development on that branch (recent commits or so).- Specified by:
getOpenBranches
in interfaceBranchDetectionCapableRepository
- Returns:
List
of branch names. May be empty.- Throws:
RepositoryException
-
pushRevision
public void pushRevision(@NotNull @NotNull File sourceDirectory, @Nullable @Nullable String vcsRevisionKey) throws RepositoryException
Description copied from interface:PushCapableRepository
Push the specified revision to the remote directory. Throws RepositoryException when failed due to connection problems or similar.- Specified by:
pushRevision
in interfacePushCapableRepository
- Parameters:
sourceDirectory
- - the working directory of the repository we want to push fromvcsRevisionKey
- - the revisionKey (usually a branch name) to push- Throws:
RepositoryException
- - when something goes wrong
-
commit
@NotNull public @NotNull String commit(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String message) throws RepositoryException
Description copied from interface:PushCapableRepository
Perform a commit (dvcs commit).- Specified by:
commit
in interfacePushCapableRepository
- Parameters:
sourceDirectory
- - which workspace directory to perform the commitmessage
- - what message use for commit- Returns:
- Created commit revision key
- Throws:
RepositoryException
- - when something goes wrong
-
getCacheId
public CacheId getCacheId(@NotNull @NotNull CachingAwareRepository.CachableOperation cachableOperation)
Description copied from interface:CachingAwareRepository
Cache id has to fulfill the following: Given two Repository objects A and B, returning equal CacheId (in terms of equals()) and a cachable operation foo(), in the following sequence of calls made in a short time period: 1. A::foo() 2. B::foo() 3. A::foo() the result of B::foo() should be the same as either the first or the second call to A::foo().- Specified by:
getCacheId
in interfaceCachingAwareRepository
- Returns:
- the cache id of repository, null if the supplied operation cannot be cached
-
isCachingSupportedFor
public boolean isCachingSupportedFor(@NotNull @NotNull CachingAwareRepository.CachableOperation cachableOperation)
- Specified by:
isCachingSupportedFor
in interfaceCachingAwareRepository
- Returns:
- true if the repository supports generation of CacheIds for a given operation
-
getVcsBranch
@NotNull public @NotNull VcsBranch getVcsBranch()
- Specified by:
getVcsBranch
in interfaceBranchAwareRepository
- Returns:
- the branch being used currently by this repository.
-
setVcsBranch
public void setVcsBranch(@NotNull @NotNull VcsBranch branch)
Description copied from interface:BranchAwareRepository
Set and prepare the repository for using an arbitrary branch. Generally the subsequent getVcsBranch should return the same branch name.- Specified by:
setVcsBranch
in interfaceBranchAwareRepository
-
mergeWorkspaceWith
public boolean mergeWorkspaceWith(@NotNull @NotNull BuildContext buildContext, @NotNull @NotNull File workspaceDir, @NotNull @NotNull String targetRevision) throws RepositoryException
Description copied from interface:BranchMergingAwareRepository
Merges a workspace located in checkout directory with the target revision.- Specified by:
mergeWorkspaceWith
in interfaceBranchMergingAwareRepository
- Parameters:
buildContext
- the build context of build doing the mergeworkspaceDir
- the workspace to use for mergetargetRevision
- the revision to merge with- Returns:
- true if the result of the merge would result in a non-empty commit
- Throws:
RepositoryException
-
isMergingSupported
public boolean isMergingSupported()
- Specified by:
isMergingSupported
in interfaceBranchMergingAwareRepository
-
getFirstCommit
public CommitContext getFirstCommit() throws RepositoryException
Description copied from interface:BranchDetectionCapableRepository
Retrieve the commit that created the Branch.- Specified by:
getFirstCommit
in interfaceBranchDetectionCapableRepository
- Returns:
- the first commit to the branch
- Throws:
RepositoryException
-
getLastCommit
public CommitContext getLastCommit() throws RepositoryException
Description copied from interface:BranchDetectionCapableRepository
Retrieve last commit on the branch set on this Repository. Method is used by Chain Branch automatic expiry. If this method returns null Chain Branch is not expired.- Specified by:
getLastCommit
in interfaceBranchDetectionCapableRepository
- Returns:
- the last commit or null if N/A
- Throws:
RepositoryException
-
addDefaultValues
public void addDefaultValues(@NotNull @NotNull BuildConfiguration buildConfiguration)
Description copied from interface:BuildConfigurationAwarePlugin
Extension point for adding default values to the form forRenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)
- Specified by:
addDefaultValues
in interfaceBuildConfigurationAwarePlugin
- Overrides:
addDefaultValues
in classAbstractRepository
- Parameters:
buildConfiguration
- -
-
prepareConfigObject
public void prepareConfigObject(@NotNull @NotNull BuildConfiguration buildConfiguration)
Description copied from interface:BuildConfigurationAwarePlugin
Do any preprocessing work before validation occurs. For repository, builder and web repository plugins this will only be called if the plugin is select by the user.- Specified by:
prepareConfigObject
in interfaceBuildConfigurationAwarePlugin
- Overrides:
prepareConfigObject
in classBaseBuildConfigurationAwarePlugin
- Parameters:
buildConfiguration
- -
-
populateFromConfig
public void populateFromConfig(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration config)
Description copied from interface:ConvertibleFromConfig
Update the current object with data in theHierarchicalConfiguration
- Specified by:
populateFromConfig
in interfaceConvertibleFromConfig
- Overrides:
populateFromConfig
in classAbstractRepository
-
getSharedCredentialIds
@NotNull public @NotNull Iterable<Long> getSharedCredentialIds()
Description copied from interface:SharedCredentialDepender
Returns a list of shared credential ids used by this class.- Specified by:
getSharedCredentialIds
in interfaceSharedCredentialDepender
- Returns:
- the list of shared credential ids used by this class.
-
beforeEditPageRendering
public void beforeEditPageRendering(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
Description copied from interface:EditActionAwareRepository
Action to be taken before rendering the edit page. Configuration can be modified by this method. Example use is verifying configuration so that proper warnings can be displayed before user takes any action.- Specified by:
beforeEditPageRendering
in interfaceEditActionAwareRepository
- Parameters:
configuration
- configuration to be loaded into the UI
-
beforeSave
public ErrorCollection beforeSave(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration configuration)
Description copied from interface:EditActionAwareRepository
Action to be taken before repository is saved from the UI. The method is called after the validate() method and only if validation is successful. If this method returns with error the configuration is not saved. Configuration can be modified by this method and the changes will be persisted.- Specified by:
beforeSave
in interfaceEditActionAwareRepository
- Returns:
- collection of error messages. Should be empty if call is successful.
-
toConfiguration
@NotNull public @NotNull org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
Description copied from interface:ConvertibleFromConfig
Generate aHierarchicalConfiguration
from the current state of the object- Specified by:
toConfiguration
in interfaceConvertibleFromConfig
- Overrides:
toConfiguration
in classAbstractRepository
- Returns:
- Always returns an
HierarchicalConfiguration
. Never null
-
validateForConnectionTesting
@NotNull public @NotNull ErrorCollection validateForConnectionTesting(@NotNull @NotNull BuildConfiguration configuration)
Description copied from interface:TestConnectionAwareRepository
A method similar toBuildConfigurationAwarePlugin.validate(BuildConfiguration)
used to validate repository configuration before connection testing. This method may be more relaxed than normal validation. Additionally, different error messages may be displayed (e.g. related to impossibility of transferring files).- Specified by:
validateForConnectionTesting
in interfaceTestConnectionAwareRepository
- Parameters:
configuration
- repository configuration to validate- Returns:
- validation errors
-
validate
@NotNull public @NotNull ErrorCollection validate(@NotNull @NotNull BuildConfiguration buildConfiguration)
Description copied from interface:BuildConfigurationAwarePlugin
Validates the properties in theBuildConfiguration
object. The name of the properties match those passed in through the form fragments inRenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)
template.- Specified by:
validate
in interfaceBuildConfigurationAwarePlugin
- Overrides:
validate
in classAbstractRepository
- Parameters:
buildConfiguration
- -- Returns:
ErrorCollection
keyed by the field name.
-
getCustomVariables
@NotNull public @NotNull Map<String,String> getCustomVariables()
Description copied from interface:CustomVariableProviderRepository
Return a map containing name->value mapping of the variables.Null values will be filtered out so it's safe to put them in the map.
- Specified by:
getCustomVariables
in interfaceCustomVariableProviderRepository
- Returns:
- Map with variable substitutions
-
getPlanRepositoryVariables
@NotNull public @NotNull Map<String,String> getPlanRepositoryVariables()
Description copied from interface:CustomVariableProviderRepository
Return a map containing name->value mapping of the plan repository format variables.Null values will be filtered out so it's safe to put them in the map.
- Specified by:
getPlanRepositoryVariables
in interfaceCustomVariableProviderRepository
- Returns:
- Map with variable substitutions
-
getMavenPomAccessor
@NotNull public @NotNull MavenPomAccessor getMavenPomAccessor()
- Specified by:
getMavenPomAccessor
in interfaceMavenPomAccessorCapableRepository
-
getAuthenticationTypes
@NotNull public @NotNull List<NameValuePair> getAuthenticationTypes()
Description copied from interface:SelectableAuthenticationRepository
List all authentication types supported by repository.- Specified by:
getAuthenticationTypes
in interfaceSelectableAuthenticationRepository
- Returns:
- List of authentication types supported by repository
-
getSshCredentialsSources
@NotNull public @NotNull List<NameValuePair> getSshCredentialsSources()
-
getPasswordCredentialsSources
@NotNull public @NotNull List<NameValuePair> getPasswordCredentialsSources()
-
getSshSharedCredentials
@NotNull public @NotNull List<NameValuePair> getSshSharedCredentials()
-
getPasswordSharedCredentials
@NotNull public @NotNull List<NameValuePair> getPasswordSharedCredentials()
-
getAuthType
public String getAuthType()
- Specified by:
getAuthType
in interfaceSelectableAuthenticationRepository
- Returns:
- the authentication type for this repository configuration
-
testConnection
@NotNull public @NotNull ErrorCollection testConnection(long timeout, @NotNull @NotNull TimeUnit unit)
Description copied from interface:TestConnectionAwareRepository
Test connection to the repository within the given timeout. The method should stop executing after the given time elapses.- Specified by:
testConnection
in interfaceTestConnectionAwareRepository
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Returns:
- Errors discovered during testing connection. Empty error collection should be returned if connection was successful. The errors should be translated to error messages, rather than field errors. Field errors are used by Bamboo to handle special cases.
-
isUseShallowClones
public boolean isUseShallowClones()
-
isUseSubmodules
public boolean isUseSubmodules()
-
getRepositoryUrl
public String getRepositoryUrl()
-
isLfs
public boolean isLfs()
-
getLocationIdentifier
@NotNull public @NotNull String getLocationIdentifier()
Description copied from interface:Repository
A string representing the location of the repository- Specified by:
getLocationIdentifier
in interfaceRepository
- Overrides:
getLocationIdentifier
in classAbstractRepository
- Returns:
-
getCommandTimeout
public int getCommandTimeout()
-
getVerboseLogs
public boolean getVerboseLogs()
-
getAuthTypeName
public String getAuthTypeName()
-
getCacheDirectory
public File getCacheDirectory()
-
getCacheDirectory
public File getCacheDirectory(GitRepositoryAccessData accessData)
-
setI18nResolver
public void setI18nResolver(com.atlassian.sal.api.message.I18nResolver i18nResolver)
-
setTrustedKeyHelper
public void setTrustedKeyHelper(TrustedKeyHelper trustedKeyHelper)
-
setCredentialsAccessor
public void setCredentialsAccessor(CredentialsAccessor credentialsAccessor)
-
getOptionDescription
public String getOptionDescription()
-
getRequirements
@NotNull public @NotNull Set<Requirement> getRequirements()
- Specified by:
getRequirements
in interfaceRequirementsAwareRepository
-
getGitCapability
@Nullable public @Nullable String getGitCapability()
-
getSshCapability
@Nullable public @Nullable String getSshCapability()
-
setCapabilityContext
public void setCapabilityContext(CapabilityContext capabilityContext)
-
setSshProxyService
public void setSshProxyService(SshProxyService sshProxyService)
-
setBranchIntegrationHelper
public void setBranchIntegrationHelper(VcsBranchIntegrationHelper branchIntegrationHelper)
-
getAccessData
public GitRepositoryAccessData getAccessData()
-
setGitCacheHandler
public void setGitCacheHandler(GitCacheHandler gitCacheHandler)
-
setAccessData
public void setAccessData(GitRepositoryAccessData accessData)
-
getHandlerDescription
@NotNull public @NotNull String getHandlerDescription()
Description copied from interface:CacheHandler
Additional information about this cache type that would be displayed in UI.This should include information about any non-obvious details like scheduling remote agent operations.
- Specified by:
getHandlerDescription
in interfaceCacheHandler
- Returns:
- additional information about this cache type that would be displayed in UI
-
getCacheDescriptions
@NotNull public @NotNull Collection<CacheDescription> getCacheDescriptions()
Collection of cache descriptions to be displayed in the admin UI. Handles both Git and GitHub repositories.- Specified by:
getCacheDescriptions
in interfaceCacheHandler
- Returns:
- collection of all found caches of given type.
-
deleteCaches
public void deleteCaches(@NotNull @NotNull Collection<String> strings, @NotNull @NotNull com.opensymphony.xwork.ValidationAware validationAware)
Delete the specified caches, handling internal data updates etc. Handles both Git and GitHub repositories.- Specified by:
deleteCaches
in interfaceCacheHandler
- Parameters:
strings
- keys fromCacheDescription.getKey()
validationAware
- consumer of UI messages
-
deleteUnusedCaches
public void deleteUnusedCaches(@NotNull @NotNull com.opensymphony.xwork.ValidationAware validationAware)
Delete all unused caches.It's the responsibility of the implementing class to figure out which caches are currently unused and optionally delete such caches on remote agents. Handles both Git and GitHub repositories.
- Specified by:
deleteUnusedCaches
in interfaceCacheHandler
- Parameters:
validationAware
- consumer of UI messages
-
isSharedCredentialsDeleted
public boolean isSharedCredentialsDeleted()
-
usePollingForBranchDetection
public boolean usePollingForBranchDetection()
Description copied from interface:BranchInformationProvider
If Bamboo generic detection polling should be used for this repository- Specified by:
usePollingForBranchDetection
in interfaceBranchInformationProvider
- Returns:
-
getGitRepository
@Nullable public @Nullable GitRepository getGitRepository()
- Specified by:
getGitRepository
in interfaceGitRepositoryFacade
-
setTemplateRenderer
public void setTemplateRenderer(TemplateRenderer templateRenderer)
- Overrides:
setTemplateRenderer
in classAbstractRepository
-
setAgentContext
public void setAgentContext(AgentContext agentContext)
-
-