Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Team City templates and Artifacts

I recently noticed I needed to reuse a build step in many projects. So I created a template where I only defined that build step, and had the projects that needed it associated with that template. That worked perfectly.

But then I realized that none of the affected projects were generating their artifacts, even though all of them were building successfully. When I went to look at the General Settings, the Artifact Paths box was grayed out and Team City told me that I could only change it inside the template!

I want my builds to have different artifact paths (some don't even generate artifacts at all), but I don't want to duplicate my build step. Is there some workaround for this?

Team City Version: 6.5.6 (build 18130)

like image 564
dario_ramos Avatar asked Feb 14 '12 21:02

dario_ramos


People also ask

What are TeamCity artifacts?

Edit page. Last modified: 28 September 2022. Build artifacts are files produced by a build. Typically, these include distribution packages, WAR files, reports, log files, and so on.

How do I add a template to TeamCity?

You can create new build configurations based on a template. You can associate/attach any number of existing build configurations with/to a template: there is the Attach to template option available from the Actions button in the upper right corner of the screen.

What is artifact path in TeamCity?

Artifact Paths Build artifacts are files produced by the build which are stored on TeamCity server and can be downloaded from the TeamCity UI or used as artifact dependencies by other builds.


2 Answers

This is how I workaround the issue:

  • Create a configuration parameter in the build parameters section of the template. I just call it Artifacts.

Artifact template parameter

  • Then reference the property in the Artifacts Paths box in the template, e.g %Artifacts%

Artifact paths image

  • Then for each configuration which inherits the template you can override the artifacts configuration parameter with a path that is relevant.

Artifact override parameter

HTH

like image 183
Siy Williams Avatar answered Oct 04 '22 00:10

Siy Williams


This is an old question and apparently only affects users with TeamCity versions less than 8.1 (as pointed out in the comments to the accepted answer).

According to the offical documentation:

Since TeamCity 8.1, the following settings can now be overridden in a build configuration inherited from a template:

  • build number format
  • artifact paths
  • build options (hanging builds detection, status widget, number of simultaneously running builds)
  • VCS checkout mode
  • checkout directory
  • clean all files before build
  • show changes from snapshot dependencies
  • execution timeout
  • all common build failure conditions, including execution timeout
like image 23
nicholas Avatar answered Oct 04 '22 01:10

nicholas