Get variable value from TeamCity REST API

We've got TeamCity Enterprise 8.0.2 with REST API plugin. I created new project, added build configuration with command line build step that runs my bash script. How can I set variable from my bash script for reading it from REST API?

4 comments
Comment actions Permalink

Hi Alexendar,

I'm a little confused by your question as to what you want to pull from the rest api.  

How I'm reading what you wrote is as follow:

1. Command Line Build Runner that calls a bash script that sets a variable
2. Access the variable through the rest api

My questions regarding above is what type of variable do you want to set?  Is this a bash variable or a teamcity parameter(configuration, environment or system)?  My next question is would you use the rest api to access the set variable after the build was complete?

Please provide more information and maybe I can help guide you in the right direction.

Thanks,
Jay

0
Comment actions Permalink

> My questions regarding above is what type of variable do you want to set?  Is this a bash variable or a teamcity parameter(configuration, environment or system)?  My next question is would you use the rest api to access the set variable after the build was complete?

All sources are stored in DVCS. After commiting to this DVCS Teamcity's trigger is looking for a special tag in commit string and starting my bash script if it matched. I need to read stdout from bash script, store it in any variable that can be read remotely through REST API. How can I do this? Have you got any ideas?

0
Comment actions Permalink

Any thoughts on just having your bash script output information to a log or txt file and then have teamcity pick it up as an artifact?  You can then fetch the artifact either via a direct url to the artifact or through the rest api which can also fetch artifact content?

0

Please sign in to leave a comment.