What do the directory numbers in the artifacts storage mean and can I change them?

Answered

I'm using the built-in artifacts storage in TeamCity 2020.2.2 and a custom artifact directory on the server's local file system. The artifact directory I specified is "DataStorage:\TeamCityBuilds\". When artifacts are deployed TeamCity generates directories such as "DataStorage:\TeamCityBuilds\MyProject\ProjectConfiguration\1229\". Within this directory, I can see my artifacts.

Where does this last number "1229" come from and is there any way for me to change the way this is generated?

Basically, from looking at the storage directory, I'd like to match the output with a specific build in TeamCity. For example, I would like TeamCity to generate directories from the current BuildNumber property so that users can easily see which files on storage belong to which build in the web UI.

I'd understand if TeamCity considers the BuildNumber not stable/unique enough, but then maybe I can understand how to match the generated ID number to the actual build number? 

 

0
2 comments

Hi,

 

this number is the internal build ID, not the build number. As you mentioned, build numbers aren't necessarily unique, and even if your workflow tries to ensure they are, it's not impossible to make a mistake that would result in overriding a number of files, which in some conditions could be very problematic.

 

The build ID is an internal ID and TeamCity uses it to locate it in disk and offer the artifacts, including the hidden ones under .teamcity, so if you change it, you will lose access to the artifact-related features, as well as to several of the build features that are stored as artifacts, by default, properties, build log and build settings. This ID is assigned to the build on triggering and stays the same throughout its lifecycle.

 

Obtaining the build id for a given build is relatively simple. You can do it visually, by simply accessing the results of the build you are interested in, then checking the URL. The number there will match the build ID. For a more automated system, the REST API also uses build IDs to identify builds, but you can also search for builds on it by other means (Such as build numbers) and the build ID will be included in the answer by default. More info about it here: https://www.jetbrains.com/help/teamcity/rest/manage-builds.html

1

Thanks, makes sense! So instead of changing the build IDs I'll use the tooling to match build ID with build number or whatever is convenient.

0

Please sign in to leave a comment.