Team City templates and Artifacts
Asked Answered
C

2

7

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)

Cassity answered 14/2, 2012 at 21:18 Comment(0)
D
14

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

Dynamic answered 15/2, 2012 at 4:53 Comment(4)
Very clever! Although I have more than one artifact in some projects. I'll define them all in the template and override them, but still feels kinda sketchy. It would be better if we could just add artifact paths to the inherited ones...Cassity
@Cassity just use a new line for each artifact path in the property. Yeah I agree it would be cleaner, you could create a feature request on YouTrack - you would have my vote.Dynamic
Here's my feature requestCassity
I believe this has been fixed in 8.x, you can now set artifacts at the template level AND override them at the individual configuration level.Savory
H
1

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
Herbivorous answered 29/3, 2015 at 13:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.