Interface ArtifactSubscriptionManager
- All Known Implementing Classes:
ArtifactSubscriptionManagerImpl
@PublicApi
public interface ArtifactSubscriptionManager
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
countSubscriptionsOfArtifact
(long artifactDefinitionId) @NotNull List<ArtifactSubscription>
findCurrentSubscriptionsForPlan
(@NotNull ImmutableJob producerJob) Get list of subscriptions existing in a chain for given artifact@Nullable ArtifactSubscription
findSubscription
(long id) Get artifact definition of specified id@NotNull List<ArtifactSubscription>
findSubscriptionsOfPlan
(@NotNull PlanIdentifier plan) Get list of artifact subscriptions associated with a plan@NotNull List<ArtifactDefinition>
findSubscriptionsPossibleForPlan
(@NotNull ImmutableJob job) Get list of chain level artifacts available for specified plan@NotNull Multimap<ResultsSummary,
ConsumedSubscription> getConsumedSubscriptions
(@NotNull ResultsSummary resultsSummary) Returns list ofConsumedSubscription
ordered by order ofResultsSummary
execution.boolean
isSubscriptionsValid
(@NotNull Job consumer, @NotNull Chain chain, @NotNull String stageName) Shorter for of validateSubscriptions method@NotNull List<ArtifactDefinitionContext>
prepareArtifactDefinitionContexts
(@NotNull ImmutableJob job, @NotNull BuildContext buildContext, SecureToken secureToken) Helps prepare the artifact definitions@NotNull List<ArtifactSubscriptionContext>
prepareSubscriptionContexts
(@NotNull ImmutableJob job, @NotNull BuildContext parentBuildContext, SecureToken secureToken) void
removeArtifactSubscription
(@NotNull ArtifactSubscription artifactSubscription) Remove artifact subscription.void
removeArtifactSubscriptions
(@NotNull Collection<ArtifactSubscription> artifactSubscriptions) Remove all artifact subscriptions in the collection.void
removeArtifactSubscriptionsOfPlan
(@NotNull ImmutablePlan plan) Remove all artifact subscriptions for a planvoid
removeArtifactSubscriptionsOfPlan
(@NotNull Plan plan) Deprecated.void
saveArtifactSubscription
(@NotNull ArtifactSubscription artifactSubscription) Save artifact subscription.void
saveArtifactSubscriptions
(@NotNull Collection<ArtifactSubscription> artifactSubscriptions) Save all artifact definitions in a collection.void
saveConsumedSubscription
(@NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull PlanResultKey planResultKey, @NotNull String artifactLinkType) Store consumed subscription.transformSubscriptions
(@NotNull List<ArtifactSubscription> subscriptions) @NotNull List<ArtifactSubscription>
validateSubscribersForMovedJob
(@NotNull ImmutableJob producer, @NotNull ImmutableChainStage producerStage) Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage@NotNull List<ArtifactSubscription>
validateSubscriptions
(@NotNull ImmutableJob consumer, @NotNull ImmutableChain chain, @NotNull String stageName) Validate consumer artifact subscriptions against target chain and stage@NotNull List<ArtifactSubscription>
validateSubscriptionsForMovedJob
(@NotNull ImmutableJob job, @NotNull ImmutableChainStage targetStage) Validate all artifact subscriptions possibly affected by moving a job.@NotNull List<ArtifactSubscription>
validateSubscriptionsForMovedStage
(@NotNull ImmutableChainStage stage, int stageIndex) Validates all artifact subscriptions possibly affected by moving a stage.
-
Field Details
-
BAMBOO_ARTIFACTS_PATH_VARIABLE
- See Also:
-
-
Method Details
-
findSubscription
Get artifact definition of specified id- Parameters:
id
- id of artifact subscription- Returns:
- artifact definition of specified id or null if not found
-
findSubscriptionsOfPlan
@NotNull @NotNull List<ArtifactSubscription> findSubscriptionsOfPlan(@NotNull @NotNull PlanIdentifier plan) Get list of artifact subscriptions associated with a plan- Parameters:
plan
- plan which associated artifact subscriptions should be retrieved- Returns:
- list of artifact subscriptions
-
findSubscriptionsPossibleForPlan
@NotNull @NotNull List<ArtifactDefinition> findSubscriptionsPossibleForPlan(@NotNull @NotNull ImmutableJob job) Get list of chain level artifacts available for specified plan- Parameters:
job
-- Returns:
- list of available artifact definitions
-
findCurrentSubscriptionsForPlan
@NotNull @NotNull List<ArtifactSubscription> findCurrentSubscriptionsForPlan(@NotNull @NotNull ImmutableJob producerJob) Get list of subscriptions existing in a chain for given artifact- Parameters:
producerJob
-- Returns:
- list of artifact subscriptions
-
prepareSubscriptionContexts
@NotNull @NotNull List<ArtifactSubscriptionContext> prepareSubscriptionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext parentBuildContext, SecureToken secureToken) - Parameters:
job
-parentBuildContext
-secureToken
-- Returns:
-
removeArtifactSubscription
Remove artifact subscription.- Parameters:
artifactSubscription
-ArtifactSubscription
to be removed
-
removeArtifactSubscriptions
void removeArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions) Remove all artifact subscriptions in the collection.- Parameters:
artifactSubscriptions
- collection ofArtifactSubscription
to be removed
-
removeArtifactSubscriptionsOfPlan
Deprecated.since 6.2 useremoveArtifactSubscriptionsOfPlan(ImmutablePlan)
insteadRemove all artifact subscriptions for a plan -
removeArtifactSubscriptionsOfPlan
Remove all artifact subscriptions for a plan -
saveArtifactSubscription
Save artifact subscription.- Parameters:
artifactSubscription
- object to be saved
-
saveArtifactSubscriptions
void saveArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions) Save all artifact definitions in a collection.- Parameters:
artifactSubscriptions
- collection of objects to be saved/updated
-
validateSubscriptions
@NotNull @NotNull List<ArtifactSubscription> validateSubscriptions(@NotNull @NotNull ImmutableJob consumer, @NotNull @NotNull ImmutableChain chain, @NotNull @NotNull String stageName) Validate consumer artifact subscriptions against target chain and stage- Parameters:
consumer
- job being consumer of artifact definitionschain
- target chainstageName
- target stage- Returns:
- list of subscriptions that NOT satisfy
-
validateSubscribersForMovedJob
@NotNull @NotNull List<ArtifactSubscription> validateSubscribersForMovedJob(@NotNull @NotNull ImmutableJob producer, @NotNull @NotNull ImmutableChainStage producerStage) Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage- Parameters:
producer
- job being producer of the artifactsproducerStage
- target stage- Returns:
- list of subscriptions that NOT satisfy
-
validateSubscriptionsForMovedJob
@NotNull @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedJob(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull ImmutableChainStage targetStage) Validate all artifact subscriptions possibly affected by moving a job. Artifact subscriptions will be broken if the producer is moved down, or if the consumer is moved up. This validation will return all artifact subscriptions that will be broken.- Parameters:
job
- job being movedtargetStage
- target stage- Returns:
- list of
ArtifactSubscription
that won't qualify after the move
-
validateSubscriptionsForMovedStage
@NotNull @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedStage(@NotNull @NotNull ImmutableChainStage stage, int stageIndex) Validates all artifact subscriptions possibly affected by moving a stage. Artifact subscriptions will be broken if the producer is moved down, or if the consumer is moved up. This validation will return all artifact subscriptions that will be broken.- Parameters:
stage
- stage being movedstageIndex
- target stage index- Returns:
- list of
ArtifactSubscription
that won't qualify after the move
-
isSubscriptionsValid
boolean isSubscriptionsValid(@NotNull @NotNull Job consumer, @NotNull @NotNull Chain chain, @NotNull @NotNull String stageName) Shorter for of validateSubscriptions method- Parameters:
consumer
- job being consumer of artifact definitionschain
- target chainstageName
- target stage- Returns:
- true if all subscriptions are valid
-
saveConsumedSubscription
void saveConsumedSubscription(@NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull String artifactLinkType) Store consumed subscription. Method should be called when artifacts are physically transferred to the agent- Parameters:
artifactSubscription
-planResultKey
-
-
getConsumedSubscriptions
@NotNull @NotNull Multimap<ResultsSummary,ConsumedSubscription> getConsumedSubscriptions(@NotNull @NotNull ResultsSummary resultsSummary) Returns list ofConsumedSubscription
ordered by order ofResultsSummary
execution. Artifacts whose producer does not exists are appended at the end, with null key.- Parameters:
resultsSummary
- a job result- Returns:
-
transformSubscriptions
List<ArtifactSubscriptionSubstitutionAware> transformSubscriptions(@NotNull @NotNull List<ArtifactSubscription> subscriptions) -
prepareArtifactDefinitionContexts
@NotNull @NotNull List<ArtifactDefinitionContext> prepareArtifactDefinitionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext buildContext, SecureToken secureToken) Helps prepare the artifact definitions- Parameters:
job
-buildContext
-secureToken
-- Returns:
-
countSubscriptionsOfArtifact
long countSubscriptionsOfArtifact(long artifactDefinitionId) - Returns:
- amount of subscriptions existing for an artifact
- Since:
- 7.1
-
removeArtifactSubscriptionsOfPlan(ImmutablePlan)
instead