Class GitBambooSpecsHandler
- java.lang.Object
-
- com.atlassian.bamboo.plugins.git.v2.AbstractGitExecutor
-
- com.atlassian.bamboo.plugins.git.v2.GitBambooSpecsHandler
-
- All Implemented Interfaces:
BambooSpecsHandler
public class GitBambooSpecsHandler extends AbstractGitExecutor implements BambooSpecsHandler
-
-
Field Summary
-
Fields inherited from class com.atlassian.bamboo.plugins.git.v2.AbstractGitExecutor
buildDirectoryManager, buildLoggingContext, customVariableContext, DEFAULT_BRANCH, i18nResolver, sshProxyService, trustedKeyHelper
-
Fields inherited from interface com.atlassian.bamboo.vcs.BambooSpecsHandler
BAMBOO_SPECS_DIRECTORY, BAMBOO_YAML_FILES
-
-
Constructor Summary
Constructors Constructor Description GitBambooSpecsHandler(CapabilityContext capabilityContext, CredentialsAccessor credentialsAccessor, CustomVariableContext customVariableContext, BuildDirectoryManager buildDirectoryManager, com.atlassian.sal.api.message.I18nResolver i18nResolver, TrustedKeyHelper trustedKeyHelper, SshProxyService sshProxyService, BuildLoggingContext buildLoggingContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Optional<String>
detectSpecRevision(@NotNull VcsRepositoryData repositoryData, @NotNull Object source)
Attempts to obtain latest revision from the repository which may have changed Bamboo Specs.@NotNull List<CommitContext>
findCommitsToSpecs(@NotNull VcsRepositoryData repositoryData, @NotNull String rev1, @NotNull String rev2)
Extracts a list of commits related to Bamboo Specs, which occurred between revisionsrev1
andrev2
.boolean
isNewer(@NotNull VcsRepositoryData repositoryData, @NotNull String rev1, @NotNull String rev2)
Returns true ifrev2
is a newer revision in the repository thanrev1
and therefore the specs should be run.boolean
isWebhookRequired()
-
Methods inherited from class com.atlassian.bamboo.plugins.git.v2.AbstractGitExecutor
fetchCacheWithRetry, fetchWithRetry, getAccessData, getCacheDirectory, getCachePath, getGitCapability, getSharedCredentialsIdField, getSshCapability, getSubstitutedAccessData, getSubstitutedAccessDataBuilder, getWorkingDirectory, isUsingSharedCredentials, rethrowOrRemoveDirectory, substituteString
-
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.vcs.BambooSpecsHandler
divergentBranchesEnabled, supportsDivergentBranches
-
-
-
-
Constructor Detail
-
GitBambooSpecsHandler
@Inject public GitBambooSpecsHandler(CapabilityContext capabilityContext, CredentialsAccessor credentialsAccessor, CustomVariableContext customVariableContext, BuildDirectoryManager buildDirectoryManager, com.atlassian.sal.api.message.I18nResolver i18nResolver, TrustedKeyHelper trustedKeyHelper, SshProxyService sshProxyService, BuildLoggingContext buildLoggingContext)
-
-
Method Detail
-
detectSpecRevision
@NotNull public @NotNull Optional<String> detectSpecRevision(@NotNull @NotNull VcsRepositoryData repositoryData, @NotNull @NotNull Object source) throws RepositoryException
Description copied from interface:BambooSpecsHandler
Attempts to obtain latest revision from the repository which may have changed Bamboo Specs.- Specified by:
detectSpecRevision
in interfaceBambooSpecsHandler
- Parameters:
repositoryData
- repositorysource
- entry point to begin scanning (for example: branch name), actual type may depend on repository type- Returns:
- latest revision or Optional.empty() if
BambooSpecsHandler.BAMBOO_SPECS_DIRECTORY
doesn't exist. - Throws:
RepositoryException
-
isNewer
public boolean isNewer(@NotNull @NotNull VcsRepositoryData repositoryData, @NotNull @NotNull String rev1, @NotNull @NotNull String rev2) throws RepositoryException
Description copied from interface:BambooSpecsHandler
Returns true ifrev2
is a newer revision in the repository thanrev1
and therefore the specs should be run. In typical cases, returns true if it is possible to reachrev1
by following parent relationship starting fromrev2
. Exceptional cases involve suspected force push or 'clear' merges that don't result in changes in specs being connected to the merge commit. In those cases it assumed that rev2 is newer even though no ancestry path exists between rev1 and rev2.- Specified by:
isNewer
in interfaceBambooSpecsHandler
- Throws:
RepositoryException
-
findCommitsToSpecs
@NotNull public @NotNull List<CommitContext> findCommitsToSpecs(@NotNull @NotNull VcsRepositoryData repositoryData, @NotNull @NotNull String rev1, @NotNull @NotNull String rev2) throws RepositoryException
Description copied from interface:BambooSpecsHandler
Extracts a list of commits related to Bamboo Specs, which occurred between revisionsrev1
andrev2
.- Specified by:
findCommitsToSpecs
in interfaceBambooSpecsHandler
- Throws:
RepositoryException
-
isWebhookRequired
public boolean isWebhookRequired()
- Specified by:
isWebhookRequired
in interfaceBambooSpecsHandler
- Returns:
- true if vcs requires setting webhook for Bamboo Specs processing, false otherwise
-
-