Reusable build steps

Hello,

We have rather complex build steps in some of our build configurations that are parameterized. Many of these steps are exactly the same in several of our build configs. The problem is that when there are changes to the build step the same changes need to be made in several build configs. What I need is a reusable build step. This would be similar to a meta-runner but rather than being an entire build config it would just be a custom script build step and its parameter values would be passed from the Build Parameters of the build config.

I have looked at templates and meta-runners and neither of these seem useful for this purpose. Is there currently any way of doing this?

Thanks,
Dave

2 comments
Comment actions Permalink

Hi Dave,

you can use TeamCity references in the code of the meta-runner (there is a hint about that in the meta-runner configuration page : "TeamCity references will be replaced in the code").
So I looks to me as you can use meta-runners in your case. Or did I miss something ?

Olivier

0
Comment actions Permalink

It doesn't sound like this is the solution I want. If the references are replaced in the code of the meta-runner then it doesn't do what I need it to do.

I'll give you a simple example:
Let's say this is a build step that is currently duplicated in several build configs:
ssh myuser@%MACHINE% 'ansible-playbook /etc/ansible/playbooks/myserver.yml --limit "%ENV%" -v'

The values for MACHINE and ENV are defined in Build Parameters. I want the subsequent meta-runner to continue to have the variables and NOT be replaced.
That way the 2 variables can be defined differently as needed in each build config's Build Parameters.

We have builds with as many as 16 steps most of which are long command lines that have a few variables. Each of these builds have no more than 5 or 6 Build Parameters.
If one of those command lines changes, the same change needs to be propagated to as many as 2 dozen build configs. I'm looking for a way to just change it once.

-Dave

0

Please sign in to leave a comment.