public class GitRepository extends AbstractStandaloneRepository implements AdvancedConfigurationAwareRepository, BranchInformationProvider, BranchMergingAwareRepository, CacheHandler, CachingAwareRepository, CheckoutCustomRevisionDataAwareRepository, CustomSourceDirectoryAwareRepository, CustomVariableProviderRepository, DeploymentAwareRepository, GitRepositoryFacade, MavenPomAccessorCapableRepository, PushCapableRepository, RequirementsAwareRepository, SelectableAuthenticationRepository, SharedCredentialDepender, UniqueRevisionIdRepository, TestConnectionAwareRepository, ScmTypePublishingRepository
CachingAwareRepository.CachableOperation| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_BRANCH |
static String |
REPOSITORY_GIT_AUTHENTICATION_TYPE |
static String |
REPOSITORY_GIT_BRANCH |
static String |
REPOSITORY_GIT_COMMAND_TIMEOUT |
static String |
REPOSITORY_GIT_FETCH_WHOLE_REPOSITORY |
static String |
REPOSITORY_GIT_MAVEN_PATH |
static String |
REPOSITORY_GIT_PASSWORD |
static String |
REPOSITORY_GIT_REPOSITORY_URL |
static String |
REPOSITORY_GIT_SSH_KEY |
static String |
REPOSITORY_GIT_SSH_PASSPHRASE |
static String |
REPOSITORY_GIT_USE_REMOTE_AGENT_CACHE |
static String |
REPOSITORY_GIT_USE_SHALLOW_CLONES |
static String |
REPOSITORY_GIT_USE_SUBMODULES |
static String |
REPOSITORY_GIT_USERNAME |
static String |
REPOSITORY_GIT_VERBOSE_LOGS |
protected static boolean |
USE_SHALLOW_CLONES |
administrationConfigurationAccessor, BUILD_TRIGGER_IP, buildDirectoryManager, buildLoggerManager, customVariableContext, featureManager, REPO_PREFIX, repositoryModuleDescriptor, templateRenderer, textProvidermoduleDescriptorSELECTED_REPOSITORY, UNKNOWN_HOSTGIT_REPOSITORIES_OF_PLANHOST_KEYFILTER_PATTERN_EXCLUDE, FILTER_PATTERN_INCLUDE, FILTER_PATTERN_OPTION, FILTER_PATTERN_REGEXCHANGESET_FILTER_PATTERN_REGEX, MAVEN_RELEASE_PLUGIN_EXCLUSION_PATTERN| Constructor and Description |
|---|
GitRepository() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDefaultValues(BuildConfiguration buildConfiguration)
Extension point for adding default values to the form for
RenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan) |
BuildRepositoryChanges |
collectChangesForRevision(PlanKey planKey,
String targetRevision)
Collects the changes for the targetRevision.
|
BuildRepositoryChanges |
collectChangesSinceLastBuild(String planKey,
String lastVcsRevisionKey)
Collects the changes since the lastVcsRevisionKey.
|
BuildRepositoryChanges |
collectChangesSinceLastBuild(String planKey,
String lastVcsRevisionKey,
String customRevision) |
String |
commit(File sourceDirectory,
String message)
Perform a commit (dvcs commit).
|
void |
deleteCaches(Collection<String> strings,
com.opensymphony.xwork.ValidationAware validationAware)
Delete the specified caches, handling internal data updates etc.
|
void |
deleteUnusedCaches(com.opensymphony.xwork.ValidationAware validationAware)
Delete all unused caches.
|
GitRepositoryAccessData |
getAccessData() |
List<NameValuePair> |
getAuthenticationTypes()
List all authentication types supported by repository.
|
String |
getAuthType() |
String |
getAuthTypeName() |
Collection<CacheDescription> |
getCacheDescriptions()
Collection of cache descriptions to be displayed in the admin UI.
|
File |
getCacheDirectory() |
File |
getCacheDirectory(GitRepositoryAccessData accessData) |
CacheId |
getCacheId(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() |
Map<String,String> |
getCustomVariables()
Return a map containing name->value mapping of the variables.
|
CommitContext |
getFirstCommit()
Retrieve the commit that created the Branch.
|
String |
getGitCapability() |
GitRepository |
getGitRepository() |
String |
getHandlerDescription()
Additional information about this cache type that would be displayed in UI.
|
String |
getHost()
What's the repository server host
|
CommitContext |
getLastCommit()
Retrieve last commit on the branch set on this Repository.
|
String |
getLocationIdentifier()
A string representing the location of the repository
|
MavenPomAccessor |
getMavenPomAccessor() |
String |
getName()
The display name for the repository type
|
List<VcsBranch> |
getOpenBranches(String context)
Set of open branches that are discovered in the repository. |
String |
getOptionDescription() |
Map<String,String> |
getPlanRepositoryVariables()
Return a map containing name->value mapping of the plan repository format variables.
|
String |
getRepositoryUrl() |
Set<Requirement> |
getRequirements() |
String |
getScm()
Get a string representing the name of the repository type.
|
Iterable<Long> |
getSharedCredentialIds()
Returns a list of shared credential ids used by this class.
|
Collection<NameValuePair> |
getSharedCredentials() |
String |
getSshCapability() |
VcsBranch |
getVcsBranch() |
boolean |
getVerboseLogs() |
boolean |
isCachingSupportedFor(CachingAwareRepository.CachableOperation cachableOperation) |
boolean |
isMergingSupported() |
protected boolean |
isOnLocalAgent() |
boolean |
isRepositoryDifferent(Repository repository)
Checks if the current repo is the same as the given repository
|
boolean |
isSharedCredentialsDeleted() |
boolean |
isUseShallowClones() |
boolean |
isUseSubmodules() |
boolean |
mergeWorkspaceWith(BuildContext buildContext,
File workspaceDir,
String targetRevision)
Merges a workspace located in checkout directory with the target revision.
|
void |
populateFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
Update the current object with data in the
HierarchicalConfiguration |
void |
prepareConfigObject(BuildConfiguration buildConfiguration)
Do any preprocessing work before validation occurs.
|
void |
pushRevision(File sourceDirectory,
String vcsRevisionKey)
Push the specified revision to the remote directory.
|
String |
retrieveSourceCode(BuildContext buildContext,
PlanVcsRevisionData planVcsRevisionData,
File sourceDirectory,
int depth) |
String |
retrieveSourceCode(BuildContext buildContext,
String vcsRevisionKey,
File sourceDirectory)
Checks out the latest source code from an appropriate repository to specified directory
|
String |
retrieveSourceCode(BuildContext buildContext,
String vcsRevisionKey,
File sourceDirectory,
int depth)
Checks out the latest source code from an appropriate repository to specified directory
|
void |
setAccessData(GitRepositoryAccessData accessData) |
void |
setBranchIntegrationHelper(BranchIntegrationHelper branchIntegrationHelper) |
void |
setCapabilityContext(CapabilityContext capabilityContext) |
void |
setCredentialsAccessor(CredentialsAccessor credentialsAccessor) |
void |
setEncryptionService(EncryptionService encryptionService) |
void |
setGitCacheHandler(GitCacheHandler gitCacheHandler) |
void |
setI18nResolver(com.atlassian.sal.api.message.I18nResolver i18nResolver) |
void |
setSshProxyService(SshProxyService sshProxyService) |
void |
setTrustedKeyHelper(TrustedKeyHelper trustedKeyHelper) |
void |
setVcsBranch(VcsBranch branch)
Set and prepare the repository for using an arbitrary branch.
|
ErrorCollection |
testConnection(long timeout,
TimeUnit unit)
Test connection to the repository within the given timeout.
|
org.apache.commons.configuration.HierarchicalConfiguration |
toConfiguration()
Generate a
HierarchicalConfiguration from the current state of the object |
boolean |
usePollingForBranchDetection()
If Bamboo generic detection polling should be used for this repository
|
ErrorCollection |
validate(BuildConfiguration buildConfiguration)
Validates the properties in the
BuildConfiguration object. |
getAdvancedEditHtml, getAdvancedViewHtml, getEditHtml, getViewHtml, getViewHtmlcheckConnection, 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, setTemplateRenderer, setTextProvider, setWorkingDir, substituteString, toMergeCapableRepositoryisConfigurationMissing, isConfigurationMissing, populateContextForEdit, populateContextForViewclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAdvancedEditHtml, getAdvancedViewHtmlcheckConnection, getKey, getMinimalEditHtml, getShortKeygetSourceCodeDirectorycustomizeBuildRequirements, removeBuildRequirementsinitgetEditHtml, getViewHtmlgetDescriptiongetBranchIntegrationEditHtmlgetKeypublic static final String DEFAULT_BRANCH
public static final String REPOSITORY_GIT_REPOSITORY_URL
public static final String REPOSITORY_GIT_AUTHENTICATION_TYPE
public static final String REPOSITORY_GIT_USERNAME
public static final String REPOSITORY_GIT_PASSWORD
public static final String REPOSITORY_GIT_BRANCH
public static final String REPOSITORY_GIT_SSH_KEY
public static final String REPOSITORY_GIT_SSH_PASSPHRASE
public static final String REPOSITORY_GIT_USE_SHALLOW_CLONES
public static final String REPOSITORY_GIT_USE_REMOTE_AGENT_CACHE
public static final String REPOSITORY_GIT_USE_SUBMODULES
public static final String REPOSITORY_GIT_MAVEN_PATH
public static final String REPOSITORY_GIT_COMMAND_TIMEOUT
public static final String REPOSITORY_GIT_VERBOSE_LOGS
public static final String REPOSITORY_GIT_FETCH_WHOLE_REPOSITORY
protected static boolean USE_SHALLOW_CLONES
@NotNull public String getName()
RepositorygetName in interface CacheHandlergetName in interface RepositorygetName in interface DescriptionProvidergetName in interface NameProvider@NotNull public String getScm()
ScmTypePublishingRepositorygetScm in interface ScmTypePublishingRepositorypublic String getHost()
RepositorygetHost in interface Repositorypublic boolean isRepositoryDifferent(@NotNull
Repository repository)
RepositoryV2isRepositoryDifferent in interface RepositoryV2repository - to compare against@NotNull public BuildRepositoryChanges collectChangesForRevision(@NotNull PlanKey planKey, @NotNull String targetRevision) throws RepositoryException
OnceOffCapableRepositorycollectChangesForRevision in interface OnceOffCapableRepositorycollectChangesForRevision in class AbstractRepositoryRepositoryException - if something goes wrong@NotNull public BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull String planKey, @Nullable String lastVcsRevisionKey) throws RepositoryException
RepositoryV2collectChangesSinceLastBuild in interface RepositoryV2lastVcsRevisionKey - can be null, if null you should ensure the correct vcsrevisionkey is returned in the BuildChanges object.RepositoryException - if something goes wrong@NotNull public BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull String planKey, @Nullable String lastVcsRevisionKey, @Nullable String customRevision) throws RepositoryException
RepositoryException@NotNull public String retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable String vcsRevisionKey, @NotNull File sourceDirectory) throws RepositoryException
CustomSourceDirectoryAwareRepositoryretrieveSourceCode in interface CustomSourceDirectoryAwareRepositoryvcsRevisionKey - - may be null if you want latest codesourceDirectory - - directory to checkout toRepositoryException@NotNull public String retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable String vcsRevisionKey, @NotNull File sourceDirectory, int depth) throws RepositoryException
BranchMergingAwareRepositoryretrieveSourceCode in interface BranchMergingAwareRepositoryvcsRevisionKey - - 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)RepositoryException@NotNull public String retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable PlanVcsRevisionData planVcsRevisionData, @NotNull File sourceDirectory, int depth) throws RepositoryException
retrieveSourceCode in interface CheckoutCustomRevisionDataAwareRepositoryRepositoryException@TestOnly protected boolean isOnLocalAgent()
@NotNull public List<VcsBranch> getOpenBranches(@Nullable String context) throws RepositoryException
BranchDetectionCapableRepositorySet 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).getOpenBranches in interface BranchDetectionCapableRepositoryList of branch names. May be empty.RepositoryExceptionpublic void pushRevision(@NotNull
File sourceDirectory,
@Nullable
String vcsRevisionKey)
throws RepositoryException
PushCapableRepositorypushRevision in interface PushCapableRepositorysourceDirectory - - the working directory of the repository we want to push fromvcsRevisionKey - - the revisionKey (usually a branch name) to pushRepositoryException - - when something goes wrong@NotNull public String commit(@NotNull File sourceDirectory, @NotNull String message) throws RepositoryException
PushCapableRepositorycommit in interface PushCapableRepositorysourceDirectory - - which workspace directory to perform the commitmessage - - what message use for commitRepositoryException - - when something goes wrongpublic CacheId getCacheId(@NotNull CachingAwareRepository.CachableOperation cachableOperation)
CachingAwareRepositorygetCacheId in interface CachingAwareRepositorypublic boolean isCachingSupportedFor(@NotNull
CachingAwareRepository.CachableOperation cachableOperation)
isCachingSupportedFor in interface CachingAwareRepository@NotNull public VcsBranch getVcsBranch()
getVcsBranch in interface BranchAwareRepositorypublic void setVcsBranch(@NotNull
VcsBranch branch)
BranchAwareRepositorysetVcsBranch in interface BranchAwareRepositorypublic boolean mergeWorkspaceWith(@NotNull
BuildContext buildContext,
@NotNull
File workspaceDir,
@NotNull
String targetRevision)
throws RepositoryException
BranchMergingAwareRepositorymergeWorkspaceWith in interface BranchMergingAwareRepositorybuildContext - the build context of build doing the mergeworkspaceDir - the workspace to use for mergetargetRevision - the revision to merge withRepositoryExceptionpublic boolean isMergingSupported()
isMergingSupported in interface BranchMergingAwareRepositorypublic CommitContext getFirstCommit() throws RepositoryException
BranchDetectionCapableRepositorygetFirstCommit in interface BranchDetectionCapableRepositoryRepositoryExceptionpublic CommitContext getLastCommit() throws RepositoryException
BranchDetectionCapableRepositorygetLastCommit in interface BranchDetectionCapableRepositoryRepositoryExceptionpublic void addDefaultValues(@NotNull
BuildConfiguration buildConfiguration)
BuildConfigurationAwarePluginRenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)addDefaultValues in interface BuildConfigurationAwarePluginaddDefaultValues in class AbstractRepositorybuildConfiguration - -public void prepareConfigObject(@NotNull
BuildConfiguration buildConfiguration)
BuildConfigurationAwarePluginprepareConfigObject in interface BuildConfigurationAwarePluginprepareConfigObject in class BaseBuildConfigurationAwarePluginbuildConfiguration - -public void populateFromConfig(@NotNull
org.apache.commons.configuration.HierarchicalConfiguration config)
ConvertibleFromConfigHierarchicalConfigurationpopulateFromConfig in interface ConvertibleFromConfigpopulateFromConfig in class AbstractRepository@NotNull public Iterable<Long> getSharedCredentialIds()
SharedCredentialDependergetSharedCredentialIds in interface SharedCredentialDepender@NotNull public org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
ConvertibleFromConfigHierarchicalConfiguration from the current state of the objecttoConfiguration in interface ConvertibleFromConfigtoConfiguration in class AbstractRepositoryHierarchicalConfiguration. Never null@NotNull public ErrorCollection validate(@NotNull BuildConfiguration buildConfiguration)
BuildConfigurationAwarePluginBuildConfiguration object. The name of the properties match those passed
in through the form fragments in RenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan) template.validate in interface BuildConfigurationAwarePluginvalidate in class AbstractRepositorybuildConfiguration - -ErrorCollection keyed by the field name.@NotNull public Map<String,String> getCustomVariables()
CustomVariableProviderRepositoryNull values will be filtered out so it's safe to put them in the map.
getCustomVariables in interface CustomVariableProviderRepository@NotNull public Map<String,String> getPlanRepositoryVariables()
CustomVariableProviderRepositoryNull values will be filtered out so it's safe to put them in the map.
getPlanRepositoryVariables in interface CustomVariableProviderRepository@NotNull public MavenPomAccessor getMavenPomAccessor()
getMavenPomAccessor in interface MavenPomAccessorCapableRepository@NotNull public List<NameValuePair> getAuthenticationTypes()
SelectableAuthenticationRepositorygetAuthenticationTypes in interface SelectableAuthenticationRepository@NotNull public Collection<NameValuePair> getSharedCredentials()
public String getAuthType()
getAuthType in interface SelectableAuthenticationRepository@NotNull public ErrorCollection testConnection(long timeout, @NotNull TimeUnit unit)
TestConnectionAwareRepositorytestConnection in interface TestConnectionAwareRepositorytimeout - the maximum time to waitunit - the time unit of the timeout argumentpublic boolean isUseShallowClones()
public boolean isUseSubmodules()
public String getRepositoryUrl()
@NotNull public String getLocationIdentifier()
RepositorygetLocationIdentifier in interface RepositorygetLocationIdentifier in class AbstractRepositorypublic int getCommandTimeout()
public boolean getVerboseLogs()
public String getAuthTypeName()
public File getCacheDirectory()
public File getCacheDirectory(GitRepositoryAccessData accessData)
public void setI18nResolver(com.atlassian.sal.api.message.I18nResolver i18nResolver)
public void setTrustedKeyHelper(TrustedKeyHelper trustedKeyHelper)
public void setEncryptionService(EncryptionService encryptionService)
public void setCredentialsAccessor(CredentialsAccessor credentialsAccessor)
public String getOptionDescription()
@NotNull public Set<Requirement> getRequirements()
getRequirements in interface RequirementsAwareRepository@Nullable public String getGitCapability()
@Nullable public String getSshCapability()
public void setCapabilityContext(CapabilityContext capabilityContext)
public void setSshProxyService(SshProxyService sshProxyService)
public void setBranchIntegrationHelper(BranchIntegrationHelper branchIntegrationHelper)
public GitRepositoryAccessData getAccessData()
public void setGitCacheHandler(GitCacheHandler gitCacheHandler)
public void setAccessData(GitRepositoryAccessData accessData)
@NotNull public String getHandlerDescription()
CacheHandlerThis should include information about any non-obvious details like scheduling remote agent operations.
getHandlerDescription in interface CacheHandler@NotNull public Collection<CacheDescription> getCacheDescriptions()
getCacheDescriptions in interface CacheHandlerpublic void deleteCaches(@NotNull
Collection<String> strings,
@NotNull
com.opensymphony.xwork.ValidationAware validationAware)
deleteCaches in interface CacheHandlerstrings - keys from CacheDescription.getKey()validationAware - consumer of UI messagespublic void deleteUnusedCaches(@NotNull
com.opensymphony.xwork.ValidationAware validationAware)
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.
deleteUnusedCaches in interface CacheHandlervalidationAware - consumer of UI messagespublic boolean isSharedCredentialsDeleted()
public boolean usePollingForBranchDetection()
BranchInformationProviderusePollingForBranchDetection in interface BranchInformationProvider@Nullable public GitRepository getGitRepository()
getGitRepository in interface GitRepositoryFacadeCopyright © 2016 Atlassian Software Systems Pty Ltd. All rights reserved.