Class BambooRemoteArtifactHandler
java.lang.Object
com.atlassian.bamboo.build.artifact.AbstractArtifactHandler
com.atlassian.bamboo.build.artifact.AbstractRepublishingArtifactHandler
com.atlassian.bamboo.build.artifact.BambooRemoteArtifactHandler
- All Implemented Interfaces:
ArtifactHandler,RepublishingArtifactHandler,InitablePluginModule<ArtifactHandlerModuleDescriptor>,BambooPluginModule
public class BambooRemoteArtifactHandler
extends AbstractRepublishingArtifactHandler
implements RepublishingArtifactHandler
-
Field Summary
FieldsFields inherited from class com.atlassian.bamboo.build.artifact.AbstractRepublishingArtifactHandler
fallbackArtifactHandlerFields inherited from class com.atlassian.bamboo.build.artifact.AbstractArtifactHandler
ALL_AGENT_TYPES, LOCAL_AGENTS, NON_LOCAL_AGENTSFields inherited from interface com.atlassian.bamboo.build.artifact.ArtifactHandler
LAN_SPEED, LOCAL_SPEED, NEVER_ARCHIVE, WAN_SPEED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ArtifactLinkDataProvidergetArtifactLinkDataProvider(Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) getArtifactLinkDataProvider(ArtifactLink artifactLink, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) longgetMaxUnarchivedFilesPerArtifact(@NotNull Map<String, String> artifactHandlersConfiguration) Returns the maximum number of files that can exist per artifact which will not be compressed and combined into a single archive.intReturn approximate transfer speed of this artifact handler in bytes per second for the specified configuration.booleanIf republishing is really supported.booleanmoveArtifactToGlobalStorage(@NotNull Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Move artifact to a 'global storage'.@NotNull ArtifactHandlerPublishingResultpublish(@NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable BuildLogger buildLogger) voidremoveAllArtifactsOfChain(@NotNull PlanKey planKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for all results of a single chain.voidremoveArtifactFromStorage(@NotNull Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.voidremoveArtifactFromStorage(@NotNull PlanResultKey planResultKey, @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.voidremoveArtifactFromStorage(@NotNull ResultKey resultKey, @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.voidremoveArtifactsFromStorage(@NotNull PlanKey planKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for all results of a single chain or job.voidremoveArtifactsFromStorage(@NotNull PlanResultKey planResultKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single plan result.@NotNull ArtifactHandlerPublishingResultrepublish(@NotNull ArtifactHandlerPublishingResult previousPublishingResult, @NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider, @Nullable BuildLogger buildLogger) Method called when remote agent tries to recover from result publishing failures.@NotNull ArtifactRetrievalStatusretrieve(@NotNull ResultKey clientKey, @NotNull Artifact artifact, @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull ArtifactRetrievalConfig artifactRetrievalConfig) Retrieve arbitraryArtifact.Methods inherited from class com.atlassian.bamboo.build.artifact.AbstractRepublishingArtifactHandler
checkIfNothingWasPublished, copyToFallbackStorageIfDeferred, getFileSetFromFallbackStorage, makeNotNullMethods inherited from class com.atlassian.bamboo.build.artifact.AbstractArtifactHandler
canHandleArtifact, configProvider, configProvider, getConfigurationKey, getConfigValue, getDefaultConfiguration, getModuleDescriptor, getSupportedAgents, initMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.bamboo.build.artifact.ArtifactHandler
canHandleArtifact, getDefaultConfiguration, getModuleDescriptor, getSupportedAgents
-
Field Details
-
ALLOW_EMPTY_ARTIFACTS
- See Also:
-
-
Constructor Details
-
BambooRemoteArtifactHandler
public BambooRemoteArtifactHandler()
-
-
Method Details
-
publish
@NotNull public @NotNull ArtifactHandlerPublishingResult publish(@NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable @Nullable BuildLogger buildLogger) throws Exception - Specified by:
publishin interfaceArtifactHandler- Throws:
Exception
-
isRepublishingSupported
public boolean isRepublishingSupported()Description copied from interface:RepublishingArtifactHandlerIf republishing is really supported. Necessary because of handlers that wrap other handlers.- Specified by:
isRepublishingSupportedin interfaceRepublishingArtifactHandler- Returns:
- true iff republishing is actually supported
-
republish
@NotNull public @NotNull ArtifactHandlerPublishingResult republish(@NotNull @NotNull ArtifactHandlerPublishingResult previousPublishingResult, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider, @Nullable @Nullable BuildLogger buildLogger) Description copied from interface:RepublishingArtifactHandlerMethod called when remote agent tries to recover from result publishing failures. It is called if the previous attempt of transferring the artifact returned statusArtifactHandlerPublishingResult.Status.DEFERRED.- Specified by:
republishin interfaceRepublishingArtifactHandler
-
retrieve
@NotNull public @NotNull ArtifactRetrievalStatus retrieve(@NotNull @NotNull ResultKey clientKey, @NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull ArtifactRetrievalConfig artifactRetrievalConfig) Description copied from interface:ArtifactHandlerRetrieve arbitraryArtifact. Artifact is found by the information in artifact parameter.- Specified by:
retrievein interfaceArtifactHandler- Parameters:
clientKey- identifier of plan or deployment doing the downloadartifact- artifact informationartifactSubscription- download details (e.g. target path, copy pattern)artifactRetrievalConfig- handler specific configuration
-
getSpeed
Description copied from interface:ArtifactHandlerReturn approximate transfer speed of this artifact handler in bytes per second for the specified configuration. Result of this method might be taken into account when deciding which artifact handler to use if multiple handlers are enabled.- Specified by:
getSpeedin interfaceArtifactHandler- Parameters:
artifactHandlersConfiguration- artifact handler configuration- Returns:
- approximate transfer speed in Bps, for example:
ArtifactHandler.LOCAL_SPEED,ArtifactHandler.LAN_SPEED,ArtifactHandler.WAN_SPEED
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single artifact. Called when removingArtifactLinkShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactFromStoragein interfaceArtifactHandler
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single plan result. Called when removingResultsSummaryShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactHandler
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for all results of a single chain or job. Called when removingPlanCalling it for chain removes only the shared artifacts. Should not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactHandler
-
removeAllArtifactsOfChain
public void removeAllArtifactsOfChain(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for all results of a single chain. Called when removingChainShould not remove artifacts that were moved to global storage.- Specified by:
removeAllArtifactsOfChainin interfaceArtifactHandler
-
getArtifactLinkDataProvider
public ArtifactLinkDataProvider getArtifactLinkDataProvider(ArtifactLink artifactLink, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) - Specified by:
getArtifactLinkDataProviderin interfaceArtifactHandler
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single artifact.- Specified by:
removeArtifactFromStoragein interfaceArtifactHandler
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single artifact. Called when removingArtifactLinkShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactFromStoragein interfaceArtifactHandler
-
moveArtifactToGlobalStorage
public boolean moveArtifactToGlobalStorage(@NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerMove artifact to a 'global storage'. Artifacts in 'global storage' should only be removed whenArtifactHandler.removeArtifactFromStorage(Artifact, ArtifactHandlerConfigProvider)is called. It is not a requirement to physically move the files as long as the above contract is fulfilled.- Specified by:
moveArtifactToGlobalStoragein interfaceArtifactHandler- Returns:
- true if move successful
-
getArtifactLinkDataProvider
@Nullable public @Nullable ArtifactLinkDataProvider getArtifactLinkDataProvider(Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) - Specified by:
getArtifactLinkDataProviderin interfaceArtifactHandler
-
getMaxUnarchivedFilesPerArtifact
public long getMaxUnarchivedFilesPerArtifact(@NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Description copied from interface:ArtifactHandlerReturns the maximum number of files that can exist per artifact which will not be compressed and combined into a single archive. If the threshold is exceeded, artifacts will be packaged into a single file before publishing.
ArtifactHandlerdoes not need to treat archived artifacts differently - from ArtifactHandler perspective the packaging is transparent. Artifact files will be compressed before invoking #publish method and decompressed after invoking #retrieve method.This method should return
ArtifactHandler.NEVER_ARCHIVEif packaging of artifacts is disabled, to always send files unarchived.- Specified by:
getMaxUnarchivedFilesPerArtifactin interfaceArtifactHandler- Overrides:
getMaxUnarchivedFilesPerArtifactin classAbstractArtifactHandler- Parameters:
artifactHandlersConfiguration- artifact handler configuration- Returns:
- maximum number of files per artifact that should not be packaged into a single file
-