External Artifacts Storage Overview
An implementations of this extension point (the implementation of an external storage plugin) should be able to upload to, download, and remove artifacts from the external storage.
The external storage plugin should be able to upload artifacts , provide UI extensions for places in the UI where artifacts are shown, provide the UI for plugin settings, handle artifact dependency resolution and handle to the storage during a build on agent, send them to the client on a request and handle the cleanup of the artifacts.
While delegating its some of it's features to the plugin, TeamCity keeps a part of its internal functions intact. Regardless of external storage settings, internal artifacts (including build logs) are still published to the TeamCity server. Besides, currently the artifacts tree is rendered in the web UI by the TeamCity server itself. It can be extended to include the information about artifacts located in an external storage, but it cannot be replaced.
Access control is to be handled by the external storage itself. TeamCity only controls the visibility of URLs in the web UI and does not provide an authentication service.
Artifacts Storage is configured on the "Project Settings" page under the dedicated tab. Using the tab, a TeamCity user can choose which storage will be used for builds’ artifacts. Also, the relevant settings page is displayed there. The choice will be applied to all build configurations in the project and its subprojects.
Publication is done from the build agent process. The plugin should provide a spring bean implementing the interface
jetbrains.buildServer.agent.ArtifactsPublisher (for future compatibility we recommend extending the base implementation
jetbrains.buildServer.agent.ArtifactsPublisherBase). The plugin may choose to should publish information about remote artifacts using
jetbrains.buildServer.agent.artifacts.AgentArtifactHelper#publishArtifactList after a build is finished. This information will be stored in a special index file as hidden build artifact and can be accessed later on.
If the external artifacts index was created during publication using
jetbrains.buildServer.agent.artifacts.AgentArtifactHelper#publishArtifactList, it it will be used by the TeamCity server to add when listing build artifacts, e.g. when adding nodes to the artifacts tree.
There are also two “classic” extension points in the TeamCity Web UI that are dedicated to displaying third party artifacts. They follow regular TeamCity Web UI extensions:
An extension point on the "Artifacts" tab of a build has the id BUILD_ARTIFACTS_FRAGMENT.
An extension point on the artifacts popup available on the project or build configuration overview for each build has the id BUILD_ARTIFACTS_POPUP_FRAGMENT.
To access artifact content via HTTP requests, the plugin should provide an implementation of the
jetbrains.buildServer.web.openapi.artifacts.ArtifactDownloadProcessor interface. To access artifact content for other purposes, it should provide implementation of the
Downloading artifact dependencies includes two steps:
Listing available external artifacts.
Downloading actual artifacts.
These steps are mapped to methods of
The plugin is expected to provide an instance of
This factory will be called with settings of external storage from where artifacts must be listed or downloaded. The resulting accessor will be used to process the dependency.
jetbrains.buildServer.agent.artifacts.ArtifactAccessorBase abstract class provides default implementation of the listing operation, that uses information from the artifacts index file. This information can also be provided using
For cleanup, the plugin is expected to have a Spring bean implementing
jetbrains.buildServer.serverSide.cleanup.CleanupExtension. It is recommended to make this bean PositionConstraintAware and place it first to make sure the extension is called before the default TeamCity cleanup procedures (that will remove builds and data stored on disk).
The implementation should use
jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext#getErrorReporter to report errors which happened during the cleanup and
jetbrains.buildServer.serverSide.artifacts.ServerArtifactHelper#removeFromArtifactList to remove artifacts which were successfully removed from the storage from the artifact list stored in the TeamCity.