Interface ArtifactManager

All Known Implementing Classes:
AbstractArtifactManager, LocalArtifactManager, RemoteArtifactManager

@PublicApi public interface ArtifactManager
A common interface for artifact managers
  • Field Details

  • 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 messages
      planResultKey - key of a plan result that created the artifact
      artifact - definition of the artifact
      minExpectedFilesCnt - 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 messages
      resultKey - key of a plan or deployment result that created the artifact
      artifact - definition of the artifact
      minExpectedFilesCnt - 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 in ArtifactHandlerPublishingResult.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 use
      planResultKey - the plan result that contains the artifact
      artifactSubscription - the artifact subscription used to identify artifact
      buildWorkingDirectory - working directory of current build
      availableArtifacts - 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 in Artifact 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

      void removeArtifactFromStorage(@NotNull @NotNull Artifact artifact)
      Removes artifact files for a single artifact.
    • removeArtifactsFromStorage

      void removeArtifactsFromStorage(@NotNull @NotNull Iterable<ArtifactLink> artifactLinks)
      Removes artifact files for all plan results attached to supplied links. Called when removing ResultsSummary Should not remove artifacts that were moved to global storage.
    • removeArtifactsFromStorage

      @Deprecated void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey)
      Deprecated.
      Removes artifact files for all results of a single. Called when removing Plan 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 removing Plan 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 removing Chain Should not remove artifacts that were moved to global storage.
      Since:
      9.2
    • moveArtifactToGlobalStorage

      void moveArtifactToGlobalStorage(@NotNull @NotNull Artifact artifact) throws IOException
      Move artifact to a 'global storage'. Artifacts in 'global storage' should only be removed when removeArtifactFromStorage(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

      boolean removeArtifactsIfOrphaned(@NotNull @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.
      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