dario_ramos
dario_ramos

Reputation: 7309

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)

Upvotes: 7

Views: 2123

Answers (2)

nicholas
nicholas

Reputation: 3047

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

Upvotes: 1

Siy Williams
Siy Williams

Reputation: 2446

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

Upvotes: 14

Related Questions