provide possible build parameter values by a script ?

Is there a way how to set build parameter values using script ?

I know there is REST AIP - I can get build parameters with
"curl --request GET http://localhost:8111/httpAuth/app/rest/buildTypes/${build_name}/parameters"
and set them similrly with PUT.

But what if I want to generate  values for only one of many parameters ?
I was not able to find how to do that in documentation. I'm genertating values for select but I
do not want to bother with all other parameters set via UI.

3 comments
Comment actions Permalink

Hi Rostislav,

You can set value for one parameter using the following request:
curl -u user:pass --request PUT http://localhost:8111/httpAuth/app/rest/buildTypes/HelloWorld_A/parameters/<parameter name> --data "parameter_value" --header "Content-Type: text/plain"

Also you can add and change parameters using Service messages.

0
Comment actions Permalink

Thank you for trying to help me, I appreciate it.

I found that I probably should have used term 'parameter specification' or 'type rawValue' instead of 'value'.
To clarify it, please look at the example below.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<properties count="1" href="/app/rest/buildTypes/id:tests/parameters">
  <property name="build_id" value="%build_id%" own="true">
    <type rawValue="select display='normal' label='build_id' description='identifier of change / build'
                              label_1='label XXX' data_1='xxx'
                              data_2='YYY' label_2='label YYY'
    "/>

  </property>
</properties>


What I want to set is not the value attributem which returns kind of useless string %build_id%, but the specification of possible/available values, i.e. contents of the tag <type>. Which is what I do not know how to GET - if it is not possible, I suppose PUT won't work too. Is there some way how to do it ?

0
Comment actions Permalink

Thank you for clarification. It is not possible to change only contents of the tag <type>, you should post the whole xml/json/plain text. You can get the parameter using GET http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/<name>, change needed values and POST it back to http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/.

0

Please sign in to leave a comment.