To save disk space and avoid performance problems, you can limit artifacts stored in specific TeamCity builds and projects. There are three main ways to do this:
TeamCity can automatically create an archive from build artifacts before publishing them. To configure this behavior, open General Settings of a build configuration and specify artifact paths (newline- or comma-separated patterns) in the following format:
[+:|-:]source => target_archive.*, where:
[+:|-:]source – a path to the files or directories to be published
as build artifacts (+:) or excluded from publishing (-:).
It is recommended to use source paths relative to the
build checkout directory,
although absolute paths are also supported.
target_archive.* – a path to an archive that TeamCity should create
to pack artifacts, where .* is the archive extension. Supported
archive types are zip, 7zip, jar,
tar, and tar.gz. A target path cannot be absolute
– specify it relative to the build checkout directory.
For example, to pack all files and subdirectories stored in the
directory_name directory into the archive_name
ZIP archive, enter the following in the Artifact paths field:
directory_name => archive_name.zip
See this documentation article for more details and examples on how to configure artifact paths.
You can specify the maximum allowed size of a build artifact file and the maximum number of artifacts per build globally on the TeamCity server. To do this, use the corresponding settings in the Build Settings section of Administration | Global Settings.
You can instruct TeamCity to automatically delete old and unnecessary artifacts of a specific build configuration. To do this, configure the clean-up rules in Project Settings | Clean-up Rules:
In the Artifact patterns field, enter newline-separated patterns for artifact names to add or exclude matching artifacts from the clean-up. For example:
+:**/file*.* – removes artifacts that contain “file”
in their names.
-:**/file*.jar – excludes .jar artifacts with “file”
in their names from clean-up.