How to programatically enable/disable a build step ?
I am implenting a controller to create builds according to a fairly simple set of rules. I have created a largish template with multiple steps and now want to enable/disable builds steps on the fly
In my controller I am using SBuildType to access the runner collection via SBuildType.getBuildRunners(); So far so good.
The problem is that thre are no methods to enable/disable the various runners. I had a peek at the properties collection and I have three of them:
use.custom.script
script.content
teamcity.step.mode
teamcity.step.mode looked like a candidate but I can only find the following property name:
BUILD_STEP_EXECUTION_MODE
which appears to only have the following allowable values:
BUILD_STEP_EXECUTION_MODE_DEFAULT
BUILD_STEP_EXECUTION_MODE_EVEN_IF_FAILED
BUILD_STEP_EXECUTION_MODE_ALWAYS
Can anyone let me know how to do this?
I am using TC 7.1 build 23907
Please sign in to leave a comment.
Hi Stuart,
You can look up the code in REST API plugin, see changeStepSetting in BuildTypeRequest.java and setSetting in PropEntityStep.java.
Basically you need the method
BTW, you might consider making your plugin public so that other users can benefit and contribute.
Great I will give this a bash thanks for the pointer. I'll report back with the approach when it works.
I can't publish the plugin as I work in a bank and that would break confidentiality rules. However, I can share techniques and happy to contribute to the forum.
Thanks again
Yep worked a treat. I built a wrapper class to access it which others may find useful:
Thanks for the assist