Access build variables/information inside build step without REST API
Hi - is it possible to access build variables/information from inside a build step without using the REST API? It seems unnecessary to make webservice calls when the information should be accessible inside the build as an available object.
Ideally we'd be able to use the API listed in the javadoc to do this in some kind of step, either a Kotlin step or something else.
An example would be reading the information about the changes listed inside the currently running build and doing XYZ with them in my build step.
Thank you!
Please sign in to leave a comment.
Hi Sthall,
It seems like you're looking for predefined TeamCity build parameters or general build parameters in TeamCity.
TeamCity provides various predefined parameters for each build that can be used in your build steps. For example:
teamcity.build.id — Build IDteamcity.build.branch — Branch name...For more detail information, please refer to https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html#Predefined+Server+Build+Parameters
You can reference a parameter by its name using the `%parameter_name%` syntax, for more detailed information, please refer to https://www.jetbrains.com/help/teamcity/configuring-build-parameters.html
If this isn't what you're looking for, please provide more details about your case.
Best Regards,
Tom
Hi Tom,
Thank you for responding. So I'm looking for ways to programmatically access/manipulate things outside of the “pre-defined” build parameters if possible. One of those things is collect a list of all the committers for a particular build's changes. I can see the functions for getting this information in the javadoc at least.
Ideally I'd be able to get the build object and that should have some kind of changes object I can iterate through.
Thanks,
Stephanie
> So I'm looking for ways to programmatically access/manipulate things outside of the “pre-defined” build parameters if possible.
Sorry, I’m still a bit unclear on what you’re looking for. Could you please share more details about what you want to achieve and why you need to access this information?
Best Regards,
Tom
Hi Tom,
Well first generally I'm trying to see what is possible, as that makes it easier to plan out what we can do when we interact with our TeamCity system.
Specifically though, in this case I want to iterate through a build's changes (in the same build), and make a list of the people whose changes (the committers) were in that build.
Thanks,
Stephanie
To programmatically access the list of committers in a build, you can either use a custom script in the build step to process changes. While direct access to committers via predefined parameters is not available.
Best Regards,
Tom