This plugin allows replacing the TeamCity built-in artifacts storage with AWS S3. The artifacts storage can be changed at the project level. After changing the storage, new artifacts produced by the builds of this project will be published to the (specified) AWS S3 bucket. Besides publishing, the plugin also implements resolving of artifact dependencies and clean-up of build artifacts.
Baseline functionality finished. Feedback wanted.
The plugin is compatible with TeamCity 2017.1 and greater
When installed and configured, the plugin:
- allows uploading artifacts to Amazon S3
- allows downloading and removing artifacts from Amazon S3
- handles resolution of artifact dependencies
- handles clean-up of artifacts
- displays artifacts located in Amazon S3 in the TeamCity web UI.
You can download the plugin and install it as an additional TeamCity plugin. The latest plugin builds:
Branch | Status | Download | TeamCity |
---|---|---|---|
master | 2018.2.x | ||
Indore-2018.1.x | Download | 2018.1.x | |
Indore-2017.2.x | Download | 2017.2.x | |
Indore-2017.1.x | Download | 2017.1.1+ |
See instructions in TeamCity documentation.
The plugin adds the Artifacts Storage tab to the Project Settings page in the TeamCity Web UI. The tab lists the built-in TeamCity artifacts storage displayed by default and marked as active.
To configure Amazon S3 storage for TeamCity artifacts, perform the following:
- Select S3 Storage as the storage type.
- Provide an optional name for your storage.
- Select an AWS region.
- Provide your AWS Security Credentials.
- Specify an existing S3 bucket to store artifacts.
- Save your settings.
- The configured S3 storage will appear on the Artifacts storage page. Make it active using the corresponding link.
Now the artifacts of this project, its subprojects, and build configurations will be stored in the configured storage.
The plugin requires to have the following S3 permissions:
- build agent:
ListBucket
,PutObject
- server:
DeleteObject
,ListAllMyBuckets
,GetBucketLocation
,GetObject
Note: When pre-signed URLs option is enabled you need to grant required build agent permissions to the TeamCity server machine.
Bad Request (400) from S3 when downloading artifact from TeamCity in "ant get" task using basic http auth scheme (httpAuth prefix in URL)
Error message returned from AWS: Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified
Workaround: use pure 'curl -L'
Failed to resolve artifact dependency X: Failed to download file 'X': Failed to download https://teamcity/X.tar]: Illegal status [403] while downloading https://s3.X.amazonaws.com/bucket/X?...: Forbidden (jetbrains.buildServer.artifacts.impl.SourcePathAwareResolvingFailedException)
This can occur if the build agent is not able to fetch the artifact from the presigned URL generated by TeamCity within the time limit which is default 60s.
This value can be modified by setting a internal TeamCity server property storage.s3.url.expiration.time.seconds
.
To build the plugin locally run the following command in the plugin root directory:
> gradle build
The plugin artifact will be produced in the following location s3-artifact-storage-server/build/distributions/s3-artifact-storage.zip
and could be installed as an external TeamCity plugin.