Conditionally execute a TeamCity build step

前端 未结 4 2064
野趣味
野趣味 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:47

    It seems TC does not support conditional runner step execution at their level except the execution policy (only if build status is successful, if all previous steps finished successfully, even if some prev steps failed, always) but that is not what you want.

    So it seems you need to provide a custom system build param for your installer generator powershell build step like system.Generate which should be a bool (you can make it hidden, prompt, get its value based a on a config param, etc), and then in your powershell runner, add this:

    param([int]$Generate)
    if ($Generate) {
      Write-Host "generating installer..."
       # call your func()
    } else {
       Write-Host "skip installer"
    }
    

    In your runner config, add -Generate %system.Generate% as a script argument (careful, not additional command argument!). %system.Generate% should expand to 1 or 0 based on its runtime value.

提交回复
热议问题