Is it possible to specify when a Build Feature is to be run?
Asked Answered
A

1

12

TeamCity 8.1.4 (build 30168)

I notice that Build Features are always run as first part of first step in the Build Steps, but is it possible to make a Build Feature run e.g. as first part of step2? Or as last part of Step1?
Any help is appreciated!

(If it is of interest, this is my concrete problem;
I have a meta runner that creates a specific build number, I use this as a first step in the build steps. I want to use the build feature "AssemblyInfo patcher", but this runs before the meta runner has done its thing)

Angelitaangell answered 9/1, 2015 at 14:59 Comment(4)
How would that build step communicate the build number to use to the next step / feature?Inflectional
@LasseV.Karlsen I use Write-Host "##teamcity[buildNumber '$BuildNumber']" in the meta runner. This works as expected. If I use custom code to update assemblyinfo.cs from %system.build.number% everything is OK. But I do not want to use custom code.Angelitaangell
Did you ever find an answer to this? I just ran into the exact same problem.Vegetal
@Bobson, no, unfortunately not, had to go for custom code.Angelitaangell
P
3
  1. Create another build configuration, move your meta-runner there.
  2. Modify your build parameter to report a build number through service message
  3. Create a snapshot dependency from your build configuration to the new one
  4. In the configuration with meta-runner go to general page, enter %dep.META_RUNNER_CONFIG_ID.build.number% to 'build number' field. This will take a build number from the dependency and set it as a build number. META_RUNNER_CONFIG_ID is the Build configuration id you will see on the general page of your configuration where you have moved meta runner.
  5. Use %build.number% as a replacement in AssemblyInfoPatcher
Pieplant answered 29/1, 2016 at 23:24 Comment(3)
Thank you, Oleg. This might be a solution, unfortunately I am not able to test this process at the moment and verify. Considering that you are a developer at JetBrains, I guess this is the way to do it, though ;)Angelitaangell
I have two custom build steps - on that happens before build, and one that happens after a successful build that modifies the parameters of the first step, making it difficult (impossible) to split the first step into a separate build. Also, I am using templates, which cannot have dependencies on other templates, requiring users to do extra wiring after implementing the templates. It looks like I may need to implement the critical build features by hand. :|Loper
I had some difficulty understanding this solution until I came across the answers at #27863851.Cacilia

© 2022 - 2024 — McMap. All rights reserved.