Retrieving build parameter's value in custom triggered build

Retrieving build parameter's value in custom triggered build: http://confluence.jetbrains.com/display/TCD7/Accessing+Server+by+HTTP#AccessingServerbyHTTP-TriggeringaBuildFromScript

As per confluence page :

To trigger a build with custom parameters (system properties and environment variables), use:

http://testuser:testpassword@teamcity.jetbrains.com/httpAuth/action.html?add2Queue=bt10&name=<full property name1>&value=<value1>&name=<full property name2>&value=<value2>

Where <full property name> is a full property name with system./env. prefix or no prefix to define configuration parameter.


I could trigger the build 'B' but with no-success to retrive value of property names set during the above call. How to retrieve teh property name & its value in build 'B' ?

For ex: If I am passing as &name=env.SOME_VAR&value=%env.SOME_VAR% from build 'A' , how to get value of 'env.SOME_VAR' in build 'B' ?. I tried with normal % convention with no-luck.

And to add on using '%' while specifying the value above - coz of the reason that it has been provided at run-time with forcefully running build 'A'  & same value needs to be set/passed to build 'B'


Any details on this would be helpful as this bit is missing from documentation.

6 comments
Comment actions Permalink

I don't understand the problem.

If you write something like this in command line runner:
curl -u un:pw http://tc/action.html?add2Queue=MyPro_Bt12&name=env.aaa&value=bbb, then the queued Bt12 would have %env.aaa% parameter to bbb

0
Comment actions Permalink

My bad, it was a typo in my build setting of not correctly adding name=value pair as part of curl call to build 'B' . It does get passed from build A & is accessable in build 'B' .

But still ( as a related problem to my other threads ) retrieving of artifacts from build 'A' in build 'B' remains to be a uncracked nut!.

To add more ligths to the problem, ( ref : http://devnet.jetbrains.com/thread/453998 & http://devnet.jetbrains.com/thread/453996 ) ,

I am trying to run build 'A' and build 'B' on tags.
- My VCS root 'url' is same in both build 'A' & build 'B' -- points till <svn.root>/tags
- in 'edit check out rules' - it uses dynamic svn-tag - which gets set when build 'A' is forced/run and same gets passed to build 'B' with custom-build-trigger option used from curl/wget command line
- Build parameters on build 'B' is getting reflected properly. But it is not able to download the artifacts as part of artifact-dependency set , since svn-tag-name passed &/or used is not fetchable for unknown reason. Have tried with all options for fetching it by selecting 'Last finishe/ last SU / last finished build with specified tag' - but no luck.

with specified tag it shows error in build 'B' like below:


[Resolving artifact dependencies] Failed to resolve artifact dependency <Proj-Name :: Build-A, last build with tag: tag-name>:
Failure while downloading artifact list from server:
Failed to download [http://<teamcity-url>/httpAuth/repository/download/bt<ID>/<tag-name>.tcbuildtag/teamcity-ivy.xml] to [<build-agent-dir>/system/.artifacts_cache/<teamcity-url>/httpAuth/repository/download/bt<Id>/<tag-name>.tcbuildtag/teamcity-ivy.xml]: Illegal status [404] while downloading ........:
Not Found (jetbrains.buildServer.artifacts.ResolvingFailedException)

0
Comment actions Permalink

What would happen, if you go to buildB/Dependencies and click "Check artifact dependencies"? I guess, there's actually no build with specified tag as TC says.

0
Comment actions Permalink

Yes, same error & when I click on 'tree-icon' to browse artifacts of build 'A'  it shows 'The build is not specified or doesn't exist, and there are no successful builds in history'. And clicking on link 'Last build with tag :<tag-name>' shows up as :  'Unable to find build: search criterias not provided.'

And to add & confirm this works just fine if it is not-dynamically set & passed tag-name. I tried against svn-trunk by mimicking these builds & there is no-problem in downloading artifacts.

Any other option I could try to achieve this with T.C version # 7.1.4 ?. Thank you.

0
Comment actions Permalink

Last finished build with specified tag means builds tagged by TC (TC has an option to tag a build, but you can only tag a finished build). This is a different and independent thing from svn tags

You can use a "Build with specified build number" in Get artifacts from and inpass build number from build a to build b.

0
Comment actions Permalink

Wow!. Thanks for letting me know on using 'Build with specified build number' option by passing additional parameter set to build-num in Build A.

It worked as per expected after passing '&name=BUILD_NUM_OF_BUILD_A&value=%env.BUILD_NUMBER%' as an extra parameter name=value pair as part of custom-script call.

Marking correct answer.

0

Please sign in to leave a comment.