Peter Brennan
Peter Brennan

Reputation: 1376

Specific cleanup interval for artifacts in TeamCity

I do have a project in TeamCity, that has a build configuration for the master release branch. This is compiled, every time a new version of our product is released.

In order to be able to pinpoint the introduction of errors, I do need a big retention time for some artifacts on this build configuration. As some other artifacts are rather big (full cd installation packages), my server's hard drive gets pretty full when simply upping the cleanup interval of this configuration.

Is it possible to configure two different cleanup intervals somehow? I would love to have a big retention time for the really important artifacts, while throwing the big ones away early.

I currently use TeamCity 9.0.3

Let's say for example, that my project has two artifacs:

smallupdatepack.zip   (32 mb)
reallybigupdatecd.iso (700 mb)

I would like to configure TeamCity in a way that has the .iso kept for e.g. the last 10 builds, but the .zip is kept for the last 150 builds.

What I do not want, is a solution where all the .zip files are kept forever, while only the .iso files are deleted by an interval, which is all that seemed possible to me by using the build configuration's setting's artifact patterns alone.

Upvotes: 2

Views: 1520

Answers (2)

CoderDennis
CoderDennis

Reputation: 13837

The answer by @Biswajit_86 looks like it's the only thing available for setting special clean up rules. I looked at it and it seems like the configuration specific settings should override the project settings and give you what you need, but maybe it doesn't work that way. Try it out and see if it works. If not, file a bug/suggestion with JetBrains.

The only other thing I could think of was to create a separate build configuration that only publishes the artifacts that you want to keep longer than your default rule. Give it a snapshot dependency on the configuration that creates the files and check the box to run on the same build agent. That way it doesn't need to rebuild them and can just publish what was already created. Set up a build trigger so that this new configuration runs whenever the other one finishes. Then set the clean up rules for this configuration to the longer retention setting.

Upvotes: 2

Biswajit_86
Biswajit_86

Reputation: 3739

You can specify custom cleanup rules for porjects/targets in Build History Clean-up page.

In your case, you can have a aggressive cleanup for all builds and a lenient cleanup for the Project/target for the master build

I have uploaded an example via an image below , if it helps

If you edit any of the settings, you can set individual period for artefacts. You can setup artefacts cleanup per target. However, for the same target you cannot setup different cleanup rules for multiple artefacts.

Upvotes: 2

Related Questions