Package com.atlassian.bamboo.storage
Interface ArtifactPathBuilder
- All Known Implementing Classes:
ArtifactPathBuilderFactoryImpl.ArtifactPathBuilderForTemporaryStorage
,ArtifactPathBuilderImpl
public interface ArtifactPathBuilder
Builds artifact paths. Can build either relative paths (relative to an unknown root artifact storage directory) or
absolute paths, depending on how the specific instance is configured. Objects implementing this interface can be
obtained and configured using the
StorageLocationService
.
An artifact path can have two formats, a plan-oriented format and a global format. The plan-oriented format groups artifacts by the plans that produced them. The global format is independent of the plan. The global format may be used when an artifact needs to survive longer than the plan that created it.
The plan oriented format looks like this:
[artifact-root] / [chain-storage-tag] / [job-part] / [build-part] / [label-part]
Where:
- [chain-storage-tag] is the chain's immutable storage tag (eg. "PROJA-PLAN1" or "plan-61257948" depending on when the plan was created).
- [job-part] is either the partial job key (eg. "JOB14") or the value "shared" for shared artifacts.
- [build-part] is the build number prefixed with the string "build-".
- [label-part] is a sanitised version of the artifact label specified by the user in the artifact definition.
Here are some examples of plan-oriented paths:
PROJA-PLAN1/JOB14/build-00035/my-non-shared-artifact PROJA-PLAN1/shared/build-00035/my-shared-artifact plan-61257948/JOB14/build-00035/my-non-shared-artifact plan-61257948/shared/build-00035/my-shared-artifact
The global format looks like this:
[artifact-root] / globalStorage / [artifact-id]
Where [artifact-id] is the plain database id of the artifact.
for example:
globalStorage/5898243
-
Method Summary
Modifier and TypeMethodDescriptiongetArtifactPath
(Artifact artifact) Returns a plan-oriented or global storage path for the supplied artifact, based on the return value of artifact.isGloballyStored().getBuildPath
(PlanResultKey planResultKey) Returns [artifact-root] / [chain-storage-tag] / [job-part] / [build-part] [job-part] will be "shared" if the parameter points to a chain rather than a job.getChainPath
(PlanKey planKey) Returns [artifact-root] / [chain-storage-tag]getEntityOrientedArtifactPath
(ResultKey resultKey, @Nullable ImmutableArtifactDefinitionBase artifactDefinition) Always returns a entity-oriented path, never a global storage path.getJobOrSharedPath
(PlanKey planKey) Returns [artifact-root] / [chain-storage-tag] / [job-part] [job-part] will be "shared" if the parameter points to a chain rather than a job.getPlanOrientedArtifactPath
(PlanResultKey planResultKey, @Nullable ImmutableArtifactDefinitionBase artifactDefinition) Always returns a plan-oriented path, never a global storage path.Returns the root artifact storage path that this instance is using to build absolute paths, or null if this instance is configured to build relative paths.Returns a path that can be used for temporary storage underneath the artifact root storage path.
-
Method Details
-
getRootPath
String getRootPath()Returns the root artifact storage path that this instance is using to build absolute paths, or null if this instance is configured to build relative paths. -
getTemporaryPath
String getTemporaryPath()Returns a path that can be used for temporary storage underneath the artifact root storage path. -
getArtifactPath
Returns a plan-oriented or global storage path for the supplied artifact, based on the return value of artifact.isGloballyStored(). -
getPlanOrientedArtifactPath
String getPlanOrientedArtifactPath(PlanResultKey planResultKey, @Nullable @Nullable ImmutableArtifactDefinitionBase artifactDefinition) Always returns a plan-oriented path, never a global storage path. ie. returns [artifact-root] / [chain-storage-tag] / [job-part] / [build-part] / [label-part] [job-part] will be "shared" if the artifact is shared or if planResultKey points to a chain rather than a job. [label-part] will be omitted if artifactDefinition is null. -
getEntityOrientedArtifactPath
String getEntityOrientedArtifactPath(ResultKey resultKey, @Nullable @Nullable ImmutableArtifactDefinitionBase artifactDefinition) Always returns a entity-oriented path, never a global storage path. ie. returns [artifact-root] / [chain-storage-tag] / [job-part] / [build-part] / [label-part] [job-part] will be "shared" if the artifact is shared or if planResultKey points to a chain rather than a job. [label-part] will be omitted if artifactDefinition is null. -
getChainPath
Returns [artifact-root] / [chain-storage-tag] -
getBuildPath
Returns [artifact-root] / [chain-storage-tag] / [job-part] / [build-part] [job-part] will be "shared" if the parameter points to a chain rather than a job.
-