public abstract class AbstractArtifactManager extends Object implements ArtifactManager
Modifier and Type | Field and Description |
---|---|
static String |
ARTIFACT_SECURITY_TOKEN |
LOGS_FOR_BUILD
Constructor and Description |
---|
AbstractArtifactManager() |
Modifier and Type | Method and Description |
---|---|
protected @Nullable Artifact |
findMatchingArtifact(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 void |
markSubscriptionAsConsumed(PlanResultKey planResultKey,
ArtifactSubscriptionContext artifactSubscription,
String linkType) |
void |
moveArtifactToGlobalStorage(@NotNull Artifact artifact)
Move artifact to a 'global storage'.
|
ArtifactPublishingResult |
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.
|
ArtifactPublishingResult |
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 |
removeArtifactFromStorage(@NotNull Artifact artifact)
Removes artifact files for a single artifact.
|
void |
removeArtifactsFromStorage(@NotNull Iterable<ArtifactLink> artifactLinks)
Removes artifact files for all plan results attached to supplied links.
|
void |
removeArtifactsFromStorage(@NotNull PlanKey planKey)
Removes artifact files for all results of a single.
|
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 |
removeOrphanedArtifacts() |
ArtifactPublishingResult |
republish(@Nullable BuildLogger buildLoggerArg,
@NotNull ResultKey resultKey,
@NotNull ArtifactPublishingResult artifactPublishingResult,
@NotNull Map<String,String> artifactHandlersConfiguration)
Retry publishing artifacts that are in
ArtifactHandlerPublishingResult.Status.DEFERRED status. |
boolean |
retrieve(@Nullable BuildLogger buildLogger,
@NotNull PlanResultKey planResultKey,
@NotNull ArtifactSubscriptionContext artifactSubscription,
@NotNull Map<String,String> artifactHandlersConfiguration,
@NotNull File buildWorkingDirectory,
@NotNull com.google.common.collect.Multimap<String,Artifact> availableArtifacts)
Retrieves a plan artifact from artifact storage.
|
boolean |
retrieve(@Nullable BuildLogger buildLogger,
@NotNull PlanResultKey planResultKey,
@NotNull ResultKey resultKey,
@NotNull ArtifactDefinitionContext artifactDefinitionContext,
@NotNull String destinationPath,
@NotNull Map<String,String> artifactHandlersConfiguration,
@NotNull File buildWorkingDirectory,
@NotNull com.google.common.collect.Multimap<String,Artifact> availableArtifacts)
Retrieves an artifact from artifact storage.
|
ErrorCollection |
validateArtifactsSize(@NotNull File baseDirectory,
@NotNull ArtifactContext artifactContext)
Validates total size of artifacts produced for single build result
|
public static final String ARTIFACT_SECURITY_TOKEN
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)
ArtifactManager
publish
in interface ArtifactManager
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 madepublic 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)
ArtifactManager
publish
in interface ArtifactManager
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 madepublic ArtifactPublishingResult republish(@Nullable @Nullable BuildLogger buildLoggerArg, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactPublishingResult artifactPublishingResult, @NotNull @NotNull Map<String,String> artifactHandlersConfiguration)
ArtifactManager
ArtifactHandlerPublishingResult.Status.DEFERRED
status.
Used for recovery of build results that failed transfer.republish
in interface ArtifactManager
public final ErrorCollection validateArtifactsSize(@NotNull @NotNull File baseDirectory, @NotNull @NotNull ArtifactContext artifactContext)
ArtifactManager
validateArtifactsSize
in interface ArtifactManager
artifactContext
- contains artifacts size quota if setpublic 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 com.google.common.collect.Multimap<String,Artifact> availableArtifacts)
ArtifactManager
retrieve
in interface ArtifactManager
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 resultpublic 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 com.google.common.collect.Multimap<String,Artifact> availableArtifacts)
ArtifactManager
Artifact
object will be used to find artifact in the storage.retrieve
in interface ArtifactManager
@Nullable protected @Nullable Artifact findMatchingArtifact(String artifactHandlerKey, Collection<Artifact> matchingArtifacts)
protected abstract void markSubscriptionAsConsumed(PlanResultKey planResultKey, ArtifactSubscriptionContext artifactSubscription, String linkType)
protected Iterable<ArtifactHandler> getArtifactHandlers(ArtifactDefinitionContext artifact, Map<String,String> artifactHandlersConfiguration)
public void removeArtifactsFromStorage(@NotNull @NotNull Iterable<ArtifactLink> artifactLinks)
ArtifactManager
ResultsSummary
Should not remove artifacts that were moved to global storage.removeArtifactsFromStorage
in interface ArtifactManager
public void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey)
ArtifactManager
Plan
Should not remove artifacts that were moved to global storage.removeArtifactsFromStorage
in interface ArtifactManager
public void removeArtifactFromStorage(@NotNull @NotNull Artifact artifact)
ArtifactManager
removeArtifactFromStorage
in interface ArtifactManager
public void moveArtifactToGlobalStorage(@NotNull @NotNull Artifact artifact) throws IOException
ArtifactManager
ArtifactManager.removeArtifactFromStorage(Artifact)
is called.
It is not a requirement to physically move the files as long as the above contract is fulfilled.moveArtifactToGlobalStorage
in interface ArtifactManager
IOException
public boolean removeOrphanedArtifacts()
removeOrphanedArtifacts
in interface ArtifactManager
public boolean removeArtifactsIfOrphaned(@NotNull @NotNull List<Long> artifactIds)
ArtifactManager
removeArtifactsIfOrphaned
in interface ArtifactManager
@NotNull public @NotNull List<ArtifactHandler> getArtifactHandlersForAgent(@NotNull @NotNull AgentType agentType)
ArtifactManager
getArtifactHandlersForAgent
in interface ArtifactManager
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.