Interface ArtifactManager
- All Known Implementing Classes:
AbstractArtifactManager
,LocalArtifactManager
,RemoteArtifactManager
@PublicApi
public interface ArtifactManager
A common interface for artifact managers
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull List<ArtifactHandler>
getArtifactHandlersForAgent
(@NotNull AgentType agentType) Get list of enabled artifact handlers usable on agent of a given type.void
moveArtifactToGlobalStorage
(@NotNull Artifact artifact) Move artifact to a 'global storage'.publish
(@Nullable BuildLogger buildLogger, @NotNull PlanResultKey planResultKey, @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.void
removeAllArtifactsOfChain
(@NotNull PlanKey planKey, @NotNull Iterable<PlanKey> jobKeys, @NotNull Map<String, String> artifactHandlersConfiguration) Removes artifact files for all results of a single chain.void
removeArtifactFromStorage
(@NotNull Artifact artifact) Removes artifact files for a single artifact.void
removeArtifactsFromStorage
(@NotNull PlanKey planKey) Deprecated.void
removeArtifactsFromStorage
(@NotNull PlanKey planKey, @NotNull Map<String, String> artifactHandlersConfiguration) Removes artifact files for all results of a single.void
removeArtifactsFromStorage
(@NotNull Iterable<ArtifactLink> artifactLinks) Removes artifact files for all plan results attached to supplied links.boolean
removeArtifactsIfOrphaned
(@NotNull List<Long> artifactIds) Removes artifacts identified by the ids on the list, but only if they are not referenced by any deployment version or build result.boolean
republish
(@Nullable BuildLogger buildLogger, @NotNull ResultKey resultKey, @NotNull ArtifactPublishingResult artifactPublishingResult, @NotNull Map<String, String> artifactHandlerConfiguration) Retry publishing artifacts that are inArtifactHandlerPublishingResult.Status.DEFERRED
status.boolean
retrieve
(@Nullable BuildLogger buildLogger, @NotNull PlanResultKey planResultKey, @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull Map<String, String> artifactHandlerConfiguration, @NotNull File buildWorkingDirectory, @NotNull Multimap<String, Artifact> availableArtifacts) Retrieves a plan artifact from artifact storage.boolean
retrieve
(@Nullable BuildLogger buildLogger, @NotNull PlanResultKey planResultKey, @NotNull ResultKey clientKey, @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.validateArtifactsSize
(@NotNull File baseDirectory, @NotNull ArtifactContext artifactContext) Validates total size of artifacts produced for single build result
-
Field Details
-
LOGS_FOR_BUILD
- See Also:
-
-
Method Details
-
publish
ArtifactPublishingResult publish(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull File baseDirectory, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull Map<String, String> artifactHandlerConfiguration, int minExpectedFilesCnt) Request copy of artifacts from a designated location to artifact storage.- Parameters:
buildLogger
- optional, used to log messagesplanResultKey
- 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
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) Request copy of artifacts from a designated location to artifact storage.- 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
ArtifactPublishingResult republish(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactPublishingResult artifactPublishingResult, @NotNull @NotNull Map<String, String> artifactHandlerConfiguration) Retry publishing artifacts that are inArtifactHandlerPublishingResult.Status.DEFERRED
status. Used for recovery of build results that failed transfer.- Since:
- 8.0
-
retrieve
boolean retrieve(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull Map<String, String> artifactHandlerConfiguration, @NotNull @NotNull File buildWorkingDirectory, @NotNull @NotNull Multimap<String, Artifact> availableArtifacts) Retrieves a plan artifact from artifact storage.- 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
boolean retrieve(@Nullable @Nullable BuildLogger buildLogger, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ResultKey clientKey, @NotNull @NotNull ArtifactDefinitionContext artifactDefinitionContext, @NotNull @NotNull String destinationPath, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration, @NotNull @NotNull File buildWorkingDirectory, @NotNull @NotNull Multimap<String, Artifact> availableArtifacts) Retrieves 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 inArtifact
object will be used to find artifact in the storage.- Parameters:
buildLogger
-planResultKey
-clientKey
-artifactDefinitionContext
-destinationPath
-artifactHandlersConfiguration
-buildWorkingDirectory
-availableArtifacts
-- Returns:
-
validateArtifactsSize
ErrorCollection validateArtifactsSize(@NotNull @NotNull File baseDirectory, @NotNull @NotNull ArtifactContext artifactContext) Validates total size of artifacts produced for single build result- Parameters:
baseDirectory
-artifactContext
- contains artifacts size quota if set- Returns:
- error set in in case of exceeding quota if set
-
removeArtifactFromStorage
Removes artifact files for a single artifact. -
removeArtifactsFromStorage
Removes artifact files for all plan results attached to supplied links. Called when removingResultsSummary
Should not remove artifacts that were moved to global storage. -
removeArtifactsFromStorage
Deprecated.since 9.1 useremoveArtifactsFromStorage(PlanKey, Map)
Removes artifact files for all results of a single. Called when removingPlan
Should not remove artifacts that were moved to global storage. -
removeArtifactsFromStorage
void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Removes artifact files for all results of a single. Called when removingPlan
Should not remove artifacts that were moved to global storage.- Since:
- 9.1
-
removeAllArtifactsOfChain
void removeAllArtifactsOfChain(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Iterable<PlanKey> jobKeys, @NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Removes artifact files for all results of a single chain. Called when removingChain
Should not remove artifacts that were moved to global storage.- Since:
- 9.2
-
moveArtifactToGlobalStorage
Move artifact to a 'global storage'. Artifacts in 'global storage' should only be removed whenremoveArtifactFromStorage(Artifact)
is called. It is not a requirement to physically move the files as long as the above contract is fulfilled.- Parameters:
artifact
-- Throws:
IOException
- Since:
- 5.0
-
removeOrphanedArtifacts
boolean removeOrphanedArtifacts()- Returns:
- true if something was removed
-
removeArtifactsIfOrphaned
Removes artifacts identified by the ids on the list, but only if they are not referenced by any deployment version or build result.- Returns:
- true if anything was removed
- Since:
- 6.9
-
getArtifactHandlersForAgent
@NotNull @NotNull List<ArtifactHandler> getArtifactHandlersForAgent(@NotNull @NotNull AgentType agentType) Get 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
-
removeArtifactsFromStorage(PlanKey, Map)