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
Fields inherited from class com.atlassian.bamboo.build.artifact.AbstractRepublishingArtifactHandler
fallbackArtifactHandler
Fields inherited from class com.atlassian.bamboo.build.artifact.AbstractArtifactHandler
ALL_AGENT_TYPES, LOCAL_AGENTS, NON_LOCAL_AGENTS
Fields inherited from interface com.atlassian.bamboo.build.artifact.ArtifactHandler
LAN_SPEED, LOCAL_SPEED, NEVER_ARCHIVE, WAN_SPEED
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable ArtifactLinkDataProvider
getArtifactLinkDataProvider
(Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) getArtifactLinkDataProvider
(ArtifactLink artifactLink, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) long
getMaxUnarchivedFilesPerArtifact
(@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.int
Return approximate transfer speed of this artifact handler in bytes per second for the specified configuration.boolean
If republishing is really supported.boolean
moveArtifactToGlobalStorage
(@NotNull Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Move artifact to a 'global storage'.@NotNull ArtifactHandlerPublishingResult
publish
(@NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable BuildLogger buildLogger) void
removeAllArtifactsOfChain
(@NotNull PlanKey planKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for all results of a single chain.void
removeArtifactFromStorage
(@NotNull Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.void
removeArtifactFromStorage
(@NotNull PlanResultKey planResultKey, @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.void
removeArtifactFromStorage
(@NotNull ResultKey resultKey, @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.void
removeArtifactsFromStorage
(@NotNull PlanKey planKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for all results of a single chain or job.void
removeArtifactsFromStorage
(@NotNull PlanResultKey planResultKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single plan result.@NotNull ArtifactHandlerPublishingResult
republish
(@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 ArtifactRetrievalStatus
retrieve
(@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, makeNotNull
Methods inherited from class com.atlassian.bamboo.build.artifact.AbstractArtifactHandler
canHandleArtifact, configProvider, configProvider, getConfigurationKey, getConfigValue, getDefaultConfiguration, getModuleDescriptor, getSupportedAgents, init
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.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:
publish
in interfaceArtifactHandler
- Throws:
Exception
-
isRepublishingSupported
public boolean isRepublishingSupported()Description copied from interface:RepublishingArtifactHandler
If republishing is really supported. Necessary because of handlers that wrap other handlers.- Specified by:
isRepublishingSupported
in 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:RepublishingArtifactHandler
Method 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:
republish
in 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:ArtifactHandler
Retrieve arbitraryArtifact
. Artifact is found by the information in artifact parameter.- Specified by:
retrieve
in 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:ArtifactHandler
Return 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:
getSpeed
in 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:ArtifactHandler
Removes artifact files for a single artifact. Called when removingArtifactLink
Should not remove artifacts that were moved to global storage.- Specified by:
removeArtifactFromStorage
in interfaceArtifactHandler
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandler
Removes artifact files for a single plan result. Called when removingResultsSummary
Should not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStorage
in interfaceArtifactHandler
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandler
Removes artifact files for all results of a single chain or job. Called when removingPlan
Calling it for chain removes only the shared artifacts. Should not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStorage
in interfaceArtifactHandler
-
removeAllArtifactsOfChain
public void removeAllArtifactsOfChain(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandler
Removes artifact files for all results of a single chain. Called when removingChain
Should not remove artifacts that were moved to global storage.- Specified by:
removeAllArtifactsOfChain
in interfaceArtifactHandler
-
getArtifactLinkDataProvider
public ArtifactLinkDataProvider getArtifactLinkDataProvider(ArtifactLink artifactLink, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) - Specified by:
getArtifactLinkDataProvider
in interfaceArtifactHandler
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandler
Removes artifact files for a single artifact.- Specified by:
removeArtifactFromStorage
in interfaceArtifactHandler
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandler
Removes artifact files for a single artifact. Called when removingArtifactLink
Should not remove artifacts that were moved to global storage.- Specified by:
removeArtifactFromStorage
in interfaceArtifactHandler
-
moveArtifactToGlobalStorage
public boolean moveArtifactToGlobalStorage(@NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandler
Move 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:
moveArtifactToGlobalStorage
in interfaceArtifactHandler
- Returns:
- true if move successful
-
getArtifactLinkDataProvider
@Nullable public @Nullable ArtifactLinkDataProvider getArtifactLinkDataProvider(Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) - Specified by:
getArtifactLinkDataProvider
in interfaceArtifactHandler
-
getMaxUnarchivedFilesPerArtifact
public long getMaxUnarchivedFilesPerArtifact(@NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Description copied from interface:ArtifactHandler
Returns 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.
ArtifactHandler
does 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_ARCHIVE
if packaging of artifacts is disabled, to always send files unarchived.- Specified by:
getMaxUnarchivedFilesPerArtifact
in interfaceArtifactHandler
- Overrides:
getMaxUnarchivedFilesPerArtifact
in classAbstractArtifactHandler
- Parameters:
artifactHandlersConfiguration
- artifact handler configuration- Returns:
- maximum number of files per artifact that should not be packaged into a single file
-