It's all about the answers!

Ask a question

requestTeamBuild + waitforTeam Build error


David Cecil (624) | asked Oct 25 '13, 4:07 a.m.
retagged Dec 16 '13, 1:01 p.m. by David Lafreniere (4.8k7)
Hi,

I'm attempting to start a Jazz build from another Jazz build, but I don't want the parent to complete until the child is complete.  I'm starting the child like this:
<target name="request_build">
            <requestTeamBuild repositoryAddress="https://192.168.115.102:9443/jazz/"
                           userId="<my_user_id>"
                   password="<my_pass>"
                   requestUUIDProperty="childBuildRequestUUID"
                   verbose="true"
                           buildDefinitionId="Test Release Build Child"/>
        </target>

and I'm waiting on it with this:
<target name="wait_for_build">
            <waitForTeamBuild repositoryAddress="https://192.168.115.102:9443/jazz/"
                           userId="<my_user_id>"
                   password="<my_pass>"
                   verbose="true"
                   requestUUID="dummy"/>
        </target>

I'm expecting the property "childBuildRequestUUID" to be set to the UUID of the build request in the parent, but it's not.  I have created the property and set it to dummy in the parent's build definition but as we can see, it's not being set by the request call.  The child build is started successfully and its requestUUID set appropriately within its context.

From the log:
[waitForTeamBuild] Ant task attribute "requestUUID" contains illegal value "dummy".

What am I doing wrong?

Thanks,
Dave

2 answers



permanent link
Nick Edgar (6.5k711) | answered Oct 25 '13, 3:51 p.m.
JAZZ DEVELOPER
Hi Dave, in the waitForTeamBuild invocation, you need to pass along the UUID for the build you're waiting for.
Try: requestUUID="${childBuildRequestUUID}"

I also recommend using:
  statesToWaitFor="CANCELED,INCOMPLETE,COMPLETE"
  buildStateProperty="childBuildState"
  buildStatusProperty="childBuildStatus"

statesToWaitFor defaults to INCOMPLETE (i.e. abandoned) and COMPLETE.  By adding CANCELED, that allows it to unblock if the build has been canceled.
Giving the names of properties to hold the build state/status allows you to check what state the build ended up in, and what its status (OK/INFO/WARNING/ERROR) is.

You may also want to set timeout to something (in seconds).  The default is to wait indefinitely.


Comments
David Cecil commented Oct 27 '13, 6:13 p.m.

 Hi Nick,


the value that's passed in (dummy) is the value of childBuildRequestUUID.  i set it to dummy in the build definition.  It appears the problem is that it's not being set correctly, presumably in the call to requestTeamBuild.  Is that correct?

Thanks,
Dave


Nick Edgar commented Oct 28 '13, 8:57 a.m. | edited Oct 28 '13, 8:59 a.m.
JAZZ DEVELOPER
Since childBuildRequestUUID only gets assigned by the call to requestTeamBuild, you need to substitute its value in the call to waitForTeamBuild, i.e. by adding:
 requestUUID="${childBuildRequestUUID}"
You can check if it's being set properly using, e.g.
  <echo message="childBuildRequestUUID is: ${childBuildRequestUUID}"/>

If you're setting it in the build definition, then the "dummy" value would likely take precedence, since normally Ant properties are assigned at most once.

David Cecil commented Nov 25 '13, 6:13 a.m.

Hi Nick, I've just got back to this after some other distractions.


I've printed the value for childBuildRequestUUID after the call and it's not being set, regardless of whether it is declared in the build definition and set to the empty string, or not declared at all.  It seems requestTeamBuild simply isn't setting it despite starting the child build.


Nick Edgar commented Nov 25 '13, 9:37 a.m. | edited Nov 25 '13, 9:40 a.m.
JAZZ DEVELOPER

When you print childBuildRequestUUID using "${childBuildRequestUUID}" does it print as empty string or as "${childBuildRequestUUID}", i.e. no substitution done?

If it's empty string, then that means it got assigned earlier, somewhere else.  If no substitution happens, then it's unassigned.
You could try using a different property name.  
Another thing to try is to set allowDuplicateRequests="true". It may be that there's already a pending build in the queue, in which case it won't queue another if allowDuplicateRequests is false. It defaults to true though, so I'd only expect this to make a difference if you're currently setting it to false.


permanent link
David Cecil (624) | answered Nov 25 '13, 7:54 p.m.
Hi Nick,

just to be clear, and to ensure I'm doing the right thing, here's the ant script:

<project name="ALPS" default="request_build">
    <property file="/var/cache/build/20131126-0805/build.properties"/>
        <target name="request_build">
            <requestTeamBuild repositoryAddress="https://192.168.115.102:9443/jazz/"
                           userId="<my_user_id>"
                   password="<my_pass>"
                   requestUUIDProperty="childBuildRequestUUID"
                   verbose="true"
                   personalBuild="true"
                           buildDefinitionId="Test Release Build Child"/>
              <echo>Ant childBuildRequestUUID: ${childBuildRequestUUID}</echo>
              <echo>Ant repositoryAddress: ${repositoryAddress}</echo>
        </target>
        <taskdef name="requestTeamBuild"
             classname="com.ibm.team.build.ant.task.RequestBuildTask" />
</project>

The output is:
Successfully requested build for build definition "Test Release Build Child".
     [echo] Ant childBuildRequestUUID:
     [echo] Ant repositoryAddress: https://192.168.115.102:9443/jazz/

BUILD SUCCESSFUL
Total time: 12 seconds

I also tried echoing the value of childBuildRequestUUID before the call to requestTeamBuild, and it printed the same as the echo after the call.  The variable is not declared/initialised anywhere before that.

Am I correct in understanding that the script should result in the shell environment variable childBuildRequestUUID being created and the UUID of the build request being set to it?

Thanks,
Dave

Comments
David Cecil commented Nov 26 '13, 4:59 a.m.

I'm not entirely certain why the scrip above didn't work.  At various points I have had to prevent variable expansion in the shell script I'm using to create the here document that is the ant script, as well as preserving the property value across the shell fork.


In short, if it was just a plain Ant script, I'm sure your suggestions would have worked.  Sorry for the distractions.

Dave


Nick Edgar commented Nov 26 '13, 10:55 a.m.
JAZZ DEVELOPER

    [echo] Ant childBuildRequestUUID: 

The property must have the empty string assigned for it to print like this.  Since the task wouldn't assign empty string, and since it prints the same before even invoking the task, it must have been previously assigned.  Try changing the name of the property.

Sorry for the distractions.
Not a problem.  What you're doing here looks like pretty normal usage.


Nick Edgar commented Nov 26 '13, 10:56 a.m.
JAZZ DEVELOPER

 > ... the script should result in the shell environment variable childBuildRequestUUID being created and the UUID of the build request being set to it? 


Not exactly. It sets an Ant property (which is also a Java system property). These aren't exposed as shell environment variables automatically, but you can import/export Ant properties from/to env vars.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.