Conditionally execute a TeamCity build step

前端 未结 4 2085
野趣味
野趣味 2020-12-16 09:16

I am working on defining a general-purpose build template for all our projects -- which I have placed at the \"root project\" level (thanks to this new feature of TeamCity 8

4条回答
  •  忘掉有多难
    2020-12-16 09:42

    I've been researching this use case as I have a very similar problem to solve. The best solution I've found so far is the one stated in fwise's answer - to include all possible steps you might need within your template, but then on a case-by-case basis disable the unrequired steps for each project.

    So in your case you would include your 'installer' build step at the root level, but disable it for any projects which inherit this template and don't have an installer.

    For a single optional step this feels like a good approach but admittedly it wouldn't scale very well to large complex templates with many optional steps.

    I picked this up from the TeamCity documentation here:

    • You can reorder build steps as needed. Note, that if you have a build configuration inherited from a template, you cannot reorder inherited build steps. However, you can insert custom build steps (not inherited) at any place and in any order, even before or between inherited build steps. Inherited build steps can be reordered in the original template only.
    • You can disable a build step temporarily or permanently, even if it is inherited from a build configuration template.

提交回复
热议问题