Class AbstractArtifactManager
java.lang.Object
com.atlassian.bamboo.build.artifact.AbstractArtifactManager
- All Implemented Interfaces:
ArtifactManager
- Direct Known Subclasses:
LocalArtifactManager,RemoteArtifactManager
-
Field Summary
FieldsFields inherited from interface com.atlassian.bamboo.build.artifact.ArtifactManager
LOGS_FOR_BUILD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable ArtifactfindMatchingArtifact(String artifactHandlerKey, Collection<Artifact> matchingArtifacts) protected Iterable<ArtifactHandler>getArtifactHandlers(ArtifactDefinitionContext artifact, Map<String, String> artifactHandlersConfiguration) @NotNull List<ArtifactHandler>getArtifactHandlersForAgent(@NotNull AgentType agentType) Get list of enabled artifact handlers usable on agent of a given type.protected abstract voidmarkSubscriptionAsConsumed(PlanResultKey planResultKey, ArtifactSubscriptionContext artifactSubscription, String linkType) voidmoveArtifactToGlobalStorage(@NotNull Artifact artifact) Move artifact to a 'global storage'.publish(@Nullable BuildLogger buildLogger, @NotNull PlanResultKey resultKey, @NotNull File baseDirectory, @NotNull ArtifactDefinitionContext artifact, @NotNull Map<String, String> artifactHandlerConfiguration, int minExpectedFilesCnt) Request copy of artifacts from a designated location to artifact storage.publish(@Nullable BuildLogger buildLogger, @NotNull ResultKey resultKey, @NotNull File baseDirectory, @NotNull ArtifactDefinitionContext artifact, @NotNull Map<String, String> artifactHandlerConfiguration, int minExpectedFilesCnt) Request copy of artifacts from a designated location to artifact storage.voidremoveAllArtifactsOfChain(@NotNull PlanKey planKey, @NotNull Iterable<PlanKey> jobKeys, @NotNull Map<String, String> artifactHandlersConfiguration) Removes artifact files for all results of a single chain.voidremoveArtifactFromStorage(@NotNull Artifact artifact) Removes artifact files for a single artifact.voidremoveArtifactsFromStorage(@NotNull PlanKey planKey) Removes artifact files for all results of a single.voidremoveArtifactsFromStorage(@NotNull PlanKey planKey, @NotNull Map<String, String> artifactHandlersConfiguration) Removes artifact files for all results of a single.voidremoveArtifactsFromStorage(@NotNull Iterable<ArtifactLink> artifactLinks) Removes artifact files for all plan results attached to supplied links.republish(@Nullable BuildLogger buildLoggerArg, @NotNull ResultKey resultKey, @NotNull ArtifactPublishingResult artifactPublishingResult, @NotNull Map<String, String> artifactHandlersConfiguration) Retry publishing artifacts that are inArtifactHandlerPublishingResult.Status.DEFERREDstatus.booleanretrieve(@Nullable BuildLogger buildLogger, @NotNull PlanResultKey planResultKey, @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull Map<String, String> artifactHandlersConfiguration, @NotNull File buildWorkingDirectory, @NotNull Multimap<String, Artifact> availableArtifacts) Retrieves a plan artifact from artifact storage.booleanretrieve(@Nullable BuildLogger buildLogger, @NotNull PlanResultKey planResultKey, @NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifactDefinitionContext, @NotNull String destinationPath, @NotNull Map<String, String> artifactHandlersConfiguration, @NotNull File buildWorkingDirectory, @NotNull Multimap<String, Artifact> availableArtifacts) Retrieves an artifact from artifact storage.final ErrorCollectionvalidateArtifactsSize(@NotNull File baseDirectory, @NotNull ArtifactContext artifactContext) Validates total size of artifacts produced for single build resultMethods 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.ArtifactManager
removeArtifactsIfOrphaned, removeOrphanedArtifacts
-
Field Details
-
ARTIFACT_SECURITY_TOKEN
- See Also:
-
-
Constructor Details
-
AbstractArtifactManager
public AbstractArtifactManager()
-
-
Method Details
-
publish
public ArtifactPublishingResult publish(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull PlanResultKey resultKey, @NotNull @NotNull File baseDirectory, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull Map<String, String> artifactHandlerConfiguration, int minExpectedFilesCnt) Description copied from interface:ArtifactManagerRequest copy of artifacts from a designated location to artifact storage.- Specified by:
publishin interfaceArtifactManager- Parameters:
buildLogger- optional, used to log messagesresultKey- key of a plan result that created the artifactartifact- definition of the artifactminExpectedFilesCnt- how many files are necessary to consider the artifact complete, null if no requirements are made- Returns:
- true if publish operation result allows the build to continue
-
publish
public ArtifactPublishingResult publish(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull File baseDirectory, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull Map<String, String> artifactHandlerConfiguration, int minExpectedFilesCnt) Description copied from interface:ArtifactManagerRequest copy of artifacts from a designated location to artifact storage.- Specified by:
publishin interfaceArtifactManager- Parameters:
buildLogger- optional, used to log messagesresultKey- key of a plan or deployment result that created the artifactartifact- definition of the artifactminExpectedFilesCnt- how many files are necessary to consider the artifact complete, null if no requirements are made- Returns:
- true if publish operation result allows the build to continue
-
republish
public ArtifactPublishingResult republish(@Nullable @Nullable BuildLogger buildLoggerArg, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactPublishingResult artifactPublishingResult, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Description copied from interface:ArtifactManagerRetry publishing artifacts that are inArtifactHandlerPublishingResult.Status.DEFERREDstatus. Used for recovery of build results that failed transfer.- Specified by:
republishin interfaceArtifactManager
-
validateArtifactsSize
public final ErrorCollection validateArtifactsSize(@NotNull @NotNull File baseDirectory, @NotNull @NotNull ArtifactContext artifactContext) Description copied from interface:ArtifactManagerValidates total size of artifacts produced for single build result- Specified by:
validateArtifactsSizein interfaceArtifactManagerartifactContext- contains artifacts size quota if set- Returns:
- error set in in case of exceeding quota if set
-
retrieve
public boolean retrieve(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration, @NotNull @NotNull File buildWorkingDirectory, @NotNull @NotNull Multimap<String, Artifact> availableArtifacts) Description copied from interface:ArtifactManagerRetrieves a plan artifact from artifact storage.- Specified by:
retrievein interfaceArtifactManager- Parameters:
buildLogger- to useplanResultKey- the plan result that contains the artifactartifactSubscription- the artifact subscription used to identify artifactbuildWorkingDirectory- working directory of current buildavailableArtifacts- artifacts found in source result- Returns:
- true if retrieval was successful, false otherwise
-
retrieve
public boolean retrieve(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactDefinitionContext artifactDefinitionContext, @NotNull @NotNull String destinationPath, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration, @NotNull @NotNull File buildWorkingDirectory, @NotNull @NotNull Multimap<String, Artifact> availableArtifacts) Description copied from interface:ArtifactManagerRetrieves an artifact from artifact storage. The important difference for that method is, that NO subscription information is updated. Useful for retrieving artifacts in non standard way (cross-plan for example) If versionArtifacts parameter is specified, the method will first try to match requested artifact with the content of the map. If match is found, information inArtifactobject will be used to find artifact in the storage.- Specified by:
retrievein interfaceArtifactManager- Returns:
-
findMatchingArtifact
@Nullable protected @Nullable Artifact findMatchingArtifact(String artifactHandlerKey, Collection<Artifact> matchingArtifacts) -
markSubscriptionAsConsumed
protected abstract void markSubscriptionAsConsumed(PlanResultKey planResultKey, ArtifactSubscriptionContext artifactSubscription, String linkType) -
getArtifactHandlers
protected Iterable<ArtifactHandler> getArtifactHandlers(ArtifactDefinitionContext artifact, Map<String, String> artifactHandlersConfiguration) -
removeArtifactsFromStorage
Description copied from interface:ArtifactManagerRemoves artifact files for all plan results attached to supplied links. Called when removingResultsSummaryShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactManager
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Description copied from interface:ArtifactManagerRemoves artifact files for all results of a single. Called when removingPlanShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactManager
-
removeAllArtifactsOfChain
public void removeAllArtifactsOfChain(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Iterable<PlanKey> jobKeys, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Description copied from interface:ArtifactManagerRemoves artifact files for all results of a single chain. Called when removingChainShould not remove artifacts that were moved to global storage.- Specified by:
removeAllArtifactsOfChainin interfaceArtifactManager
-
removeArtifactsFromStorage
Description copied from interface:ArtifactManagerRemoves artifact files for all results of a single. Called when removingPlanShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactManager
-
removeArtifactFromStorage
Description copied from interface:ArtifactManagerRemoves artifact files for a single artifact.- Specified by:
removeArtifactFromStoragein interfaceArtifactManager
-
moveArtifactToGlobalStorage
Description copied from interface:ArtifactManagerMove artifact to a 'global storage'. Artifacts in 'global storage' should only be removed whenArtifactManager.removeArtifactFromStorage(Artifact)is called. It is not a requirement to physically move the files as long as the above contract is fulfilled.- Specified by:
moveArtifactToGlobalStoragein interfaceArtifactManager- Throws:
IOException
-
getArtifactHandlersForAgent
@NotNull public @NotNull List<ArtifactHandler> getArtifactHandlersForAgent(@NotNull @NotNull AgentType agentType) Description copied from interface:ArtifactManagerGet list of enabled artifact handlers usable on agent of a given type. This method should be called by agents and it doesn't filter artifact handlers according to - Bamboo instance type- Specified by:
getArtifactHandlersForAgentin interfaceArtifactManager
-