It's all about the answers!

Ask a question

Chaining up Builds


Thomassian Guillaume (411) | asked May 10 '10, 9:30 a.m.
How can I chain up actions in order to get successive builds, like we can have with TeamCity or Hudson ?

Here's the process i'd like to execute
1-Continuous build (i already have this build working)
2-on build success, copy sources on a remote filesystem
3-on copy success, call a remote batch by url invocation

Any help would be appreciated !

17 answers



permanent link
Nick Edgar (6.5k711) | answered May 11 '10, 4:36 p.m.
JAZZ DEVELOPER
Hi Guillaume, as mentioned in your other post, you can use the <requestTeamBuild> Ant task to kick off another build from the first build's script. There's not currently any support for configuring this in the UI.

The Ant task reference topic in the Help provides details on how to use this task.

a+,
Nick

permanent link
Nick Edgar (6.5k711) | answered May 11 '10, 4:37 p.m.
JAZZ DEVELOPER
If you describe how you have this set up in Hudson or Team City, I might be able to provide a more concrete recommendation. Thanks.

permanent link
Thomassian Guillaume (411) | answered May 17 '10, 4:12 a.m.
Hi Guillaume, as mentioned in your other post, you can use the <requestTeamBuild> Ant task to kick off another build from the first build's script. There's not currently any support for configuring this in the UI.

The Ant task reference topic in the Help provides details on how to use this task.

a+,
Nick


Hi nedgar, it almost works !
It would be perfect if y could synchronise the different tasks. With <requestTeamBuild> all tasks are launched without waiting each other to complete.

I'll prototype something with <waitForTeamBuild>, is this the right way ?

Regards,

Guillaume

permanent link
Thomassian Guillaume (411) | answered May 17 '10, 8:01 a.m.
Hi Guillaume, as mentioned in your other post, you can use the <requestTeamBuild> Ant task to kick off another build from the first build's script. There's not currently any support for configuring this in the UI.

The Ant task reference topic in the Help provides details on how to use this task.

a+,
Nick


Hi nedgar, it almost works !
It would be perfect if y could synchronise the different tasks. With <requestTeamBuild> all tasks are launched without waiting each other to complete.

I'll prototype something with <waitForTeamBuild>, is this the right way ?

Regards,

Guillaume

Hi again !

Here's an abstract of an ant task chaining up different builds.


requestTeamBuild repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
requestUUIDProperty="requestUUID"
buildDefinitionId="Synchroniser_j2ee_Integration_2"/>

echo message="Attente de la fin de la tache ID=${requestUUID}"/>

waitForTeamBuild repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
requestUUID="${requestUUID}"
statesToWaitFor="COMPLETED"
verbose="true"
timeout="240"
interval="1"/>


(sorry, i removed '<' chars cause they break the code in the post...)

unfortunately , i always get a timeout on the waitForTeamlBuild, even if the previous build is cancelled or complete.

In the logs, i get :

[echo] Attente de la fin de la tache ID=_Mjt3IWGaEd-0PatKv_pDNA
[waitForTeamBuild] Aucun proxy n'est utilis pour accder https://xxx.xxx.xxx.xxx:xxxx/jazz/
[waitForTeamBuild] Dbut de l'attente du passage de la gnration "_Mjt3IWGaEd-0PatKv_pDNA" l'tat COMPLETED.
[waitForTeamBuild] Dpassement du dlai d'attente maximal de 240 seconde(s) pour la gnration "_Mjt3IWGaEd-0PatKv_pDNA".
[waitForTeamBuild] La gnration "_Mjt3IWGaEd-0PatKv_pDNA" est passe l'tat IN_PROGRESS. Le dlai d'attente a t de 240 seconde(s).


So task is never detected as COMPLETE or CANCELED, and remains IN_PROGRESS...

Where's the problem ?

Regards,

Guillaume

permanent link
Nick Edgar (6.5k711) | answered May 17 '10, 11:00 a.m.
JAZZ DEVELOPER
Hi Guillaume,

The overall approach looks good to me.

How long does the 'Synchroniser_j2ee_Integration_2' build take to run? Could it be that the 240 seconds limit is just too short? That is, is the 'IN_PROGRESS' state it's reporting after 240 seconds accurate?

If you want it to stop waiting if the build is canceled or abandoned, you'll need to add those states, e.g. statesToWaitFor="COMPLETED, CANCELED, INCOMPLETE".
You can check which state it ended up in using buildStateProperty="buildState" to set the buildState property to the resulting state. Likewise for build status, you can use buildStatusProperty="buildStatus".

> (sorry, i removed '<' chars cause they break the code in the post...)
Try checking 'Disable HTML in this post' when posting. Also note that the forum software has a bug whereby this setting gets lost when you use Preview.

a+,
Nick

permanent link
Thomassian Guillaume (411) | answered May 17 '10, 11:15 a.m.
>How long does the 'Synchroniser_j2ee_Integration_2' build take to run? Could it be that the 240 seconds limit is just too short? That is, is the 'IN_PROGRESS' state it's reporting after 240 seconds accurate?

Even without the timeout option, waiting build never exits !

>If you want it to stop waiting if the build is canceled or abandoned, you'll need to add those states, e.g. statesToWaitFor="COMPLETED, CANCELED, INCOMPLETE".

It doesn't change anything.

I forgot to tell you that the builds run on separate engines.

permanent link
Nick Edgar (6.5k711) | answered May 17 '10, 11:51 a.m.
JAZZ DEVELOPER
>
Even without the timeout option, waiting build never exits !

That is expected. If you don't give a timeout, it waits forever (for the given state(s)).


>If you want it to stop waiting if the build is canceled or abandoned, you'll need to add those states, e.g. statesToWaitFor="COMPLETED, CANCELED, INCOMPLETE".

It doesn't change anything.

That was just a suggestion for getting it to stop waiting on the other end states, I didn't think it would solve the problem.


I forgot to tell you that the builds run on separate engines.

That's good, since if the main build is waiting, the other build needs to get picked up by some other engine.

Can you clarify, though: does the actual synchronizer build actually finish? That is, is the problem that the nested build actually hangs, or that waitForTeamBuild is not seeing it finish properly?

permanent link
Thomassian Guillaume (411) | answered May 17 '10, 11:57 a.m.
Thanks for your answers !

>Can you clarify, though: does the actual synchronizer build actually finish? That is, is the problem that the nested build actually hangs, or that waitForTeamBuild is not seeing it finish properly?

yes, waitForTeamBuild is not seeing it finish properly.

permanent link
Nick Edgar (6.5k711) | answered May 17 '10, 1:46 p.m.
JAZZ DEVELOPER
The logic in the waitForTeamBuild task is really simple. It basically just does:
- fetch the build result (with refresh flag, to ignore any cached item)
- check if it's in one of the desired states
- if not, sleep for a bit and repeat, unless timed out

What is the network topology between the server and the build machines running JBE? Is there any difference if you run JBE on the same machine as the server? Is it possible there's some kind of caching proxy between the two (even if there were, it shouldn't be caching these kinds of requests, but you never know).

Which JDK are you using to run JBE (try java -version from the JBE directory)? If not already, can you try with the one included in the RTC client? For more context, see https://jazz.net/wiki/bin/view/Main/BuildFAQ#WhichJDK .

You could also try looking at the internal representations for the request and result (from the build machine).

- take the request UUID printed out by your <echo> statement
- in a browser, fetch the following, using the request UUID:
https://{your repository including /jazz suffix}/resource/itemOid/com.ibm.team.build.BuildRequest/_Mjt3IWGaEd-0PatKv_pDNA?_mediaType=text/json&_prettyPrint=true
- look through it for the result handle, e.g.:
"buildResult": {
"com.ibm.team.repository.typeName": "com.ibm.team.build.BuildResult",
"itemId": "_lSlEsF_FEd-WX8dOKD-Ydg",
"uri": "itemOid\/com.ibm.team.build.BuildResult\/_lSlEsF_FEd-WX8dOKD-Ydg"
},
- fetch the result, replacing the result item id (not the request item id) in:
https://{your repo}/resource/itemOid/com.ibm.team.build.BuildResult/_lSlEsF_FEd-WX8dOKD-Ydg?_mediaType=text/json&_prettyPrint=true
- look for the buildState, e.g.:
"buildState": "COMPLETED",

If you want to track the state of the child build as it proceeds, you only need to refresh the result url.

permanent link
Nick Edgar (6.5k711) | answered May 17 '10, 1:48 p.m.
JAZZ DEVELOPER
It might be easier to specify _mediaType=text/xml instead of text/json, to get the result in-browser instead of in a text editor.

Your answer


Register or to post your answer.