Manually delete build logs and artifacts - does it affects TeamCity?

Completed

We have a very large TeamCity installation and stopping/restarting the service is a complicated process (we prefer not to do this very often).

Also we have some projects which results in builds with very large artifacts.

My question is: can we manually delete artifacts and buildLog.msg5 files from older (few days old) builds while the TeamCity process is running? And if we do so, how would that impact the service?

We are running TeamCity 2019.1.

Thanks.

0
7 comments

Hi George,

The recommended approach would be to use the manual Clean-Up Tool included in 2019.1. This will prevent any stagnant or obsolete database-related data from accumulating as well as prevent any dependencies and/or pinned artifacts from being removed. 

If for some reason, the Clean-Up Tool doesn't work in your case, you can manually delete the artifacts and logs. Just keep in mind that any builds that would be dependent on these artifacts will fail if they attempt to download one of the deleted artifacts. 

0

I should have also mentioned that setting up the server's clean-up rules can enable TeamCity to run clean-up automatically with a wide variety of options. Regular automatic clean-up would actually be more highly recommended than running it manually only periodically. The manual method should be reserved only for occasions where running clean-up can't wait until the regularly scheduled clean-up cycle. 

Another topic regarding TeamCity clean-up is the enhancements made to the Clean-Up Settings in 2019.2. With this release, we have introduced more options for flexibility in the clean-up process. In addition to an existing base rule for a project or build configuration, you can now create multiple keep rules to specify builds and data to preserve during the clean-up. The keep rules can also now cover cases like keeping all builds with a certain tag or within a certain branch. 

0

Hello Eric,

Thank you for the answer. We currently run version 2019.1, and do not have yet a planned date for an update.

We need to run a manual clean-up of artifacts because the automated clean-up job (which is ran every day) does not clean artifacts of some older builds, as we would expect. For example, we have some builds with the following Clean-Up Rules:

- clean artifacts: custom policy, 1 day since last build, 1-th successful build;

- clean history: default policy (clean history more than 365 days older)

- clean everything: default policy (365 days)

- dependecies: use default.

Then, all of the dependent builds, which depend on artifacts generated by this build, also have the same clean-up policies, but when the automatic clean-up job is run the artifacts of builds older than one day (or weeks, months) are not deleted. I think I looked through all the dependent builds and clean-up settings and I think they are set properly.

Can this happen because of the known issue (in versions 2019.1 or older) mentioned here? https://youtrack.jetbrains.com/issue/TW-63034

0

You may be able to identify the reason these artifacts are being preserved by examining your teamcity-cleanup.log from your TeamCity server. In some cases, the log entry will actually contain a reference to a YouTrack issue number. 

0

Hi Eric, we plan to use a different approach to delete older builds (past one year) by using rest API calls.

Since the API call: "/app/rest/latest/builds?locator=startDate(date:...,condition:after),finishDate(date:...,condition:before),lookupLimit=5000000" fails (Gateway timeout), because we currently have over 5,000,000 active builds, I will use a combination of: "SELECT build_id,queued_time FROM build_state WHERE queued_time < TIMESTAMP_WE_NEED" and then call "DELETE /app/rest/latest/builds/id:<BUILD_ID>". At least that's the best I can think of right now.

Then, my question is: what data is deleted when we call the "DELETE" rest API on a build? Are all the other related resources also deleted, like:

- artifacts;

- build logs;

- related changes history;

- related revisions history;

- etc.?

Or, do we have to parse the response XML from "GET /app/rest/builds/id:<BUILD_ID>" and manually call DELETE on the various entries for changes, revisions, artifacts, etc.?

Thank you.

0

When you call DELETE on a build, it will remove all artifacts, build logs, etc for only that build. Any resources for which the build is dependent on will remain unless you explicitly DELETE them. Since you're running a regular clean-up, they may be removed in the next clean-up after old dependent builds have been removed. 

If it was up to me, I would make a backup before I begin. I would then use your REST request and then wait to do anything further until after a clean-up cycle. You can then check to see if it helps to free up some of the artifacts that you were previously expecting clean-up to remove.

0

Hi Eric, that worked. We selected older builds, either by build configuration or all configurations, and then we call the DELETE REST API and all resources associated with the build are removed, including the folder containing the build files (logs, artifacts) from disk (after we start a manual "Clean-up" operation).

Thank you!

0

Please sign in to leave a comment.