vaultcheckin nant task only works when called alone

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
kkemp
Posts: 2
Joined: Wed Sep 19, 2007 10:09 am

vaultcheckin nant task only works when called alone

Post by kkemp » Wed Sep 19, 2007 10:17 am

My build script attempts to do the following tasks using Vault nant tasks

1. Remove all working folder associations (so that different branches can be checked out to the same physical path)

2. Checkout exclusively the source tree

3. Checkin the changes made by the build script, undoing unchanged files

4. Label Vault with the build number

The problem I am having is that when called as part of my overall build task, the nant checkin task does nothing. It does not report an error, it just performs no operations. What's odd is that when I call that task directly, it performs exactly as expected.

Here is my overall build task:

Code: Select all

<target name="EnterpriseBuild" description="Base Checkbox Survey Server build">

		<property name="install.dbsetuptablesfilename" value="${path.buildroot}\CheckboxWeb\install\installscripts\Checkbox_Tables.sql"/>
		<property name="install.dbsetupsprocsfilename" value="${path.buildroot}\CheckboxWeb\install\installscripts\Checkbox_StoredProcedures.sql"/>
		<property name="install.dbsetuptviewsfilename" value="${path.buildroot}\CheckboxWeb\install\installscripts\Checkbox_Views.sql"/>

		<call target="IncrementBuildNumber"/>
		<property name="path.destination" value="C:\Builds\Checkbox Survey Server\${version.new}" />
		
		<mkdir dir="${path.destination}"/>
		<call target="StartLog"/>
		<call target="CleanBuildPath"/>
		<call target="RemoveWorkingFolders_Vault4"/>
		<call target="GetLatest_Vault4"/>
		<call target="UpdateBuildNumber"/> 
		<call target="BuildDBScripts"/>
		<call target="BuildDeveloperSolution"/>
		<call target="CompileDeveloper"/>
		<call target="CopyToDestination"/>
		<call target="CommitBuildNumber"/>
		<call target="CommitChanges_Vault4"/>
		<call target="LabelVersion_Vault4"/>
		<call target="EndLog"/>
		
	</target>
Here are the relevant Vault tasks:

Code: Select all

<target name="RemoveWorkingFolders_Vault4" description="Removes all existing working folder associations">

		<echo>
			Removing working folder associations from Vault 4.04 with these settings:
			username:	${vault.user}
			password:	${vault.pw}
			host:		${vault.host}
			repository:	${vault.repository}
			path:		${vault.path}
			destination:${path.buildroot}
		</echo>
		
		<!-- List the working folder associations in an XML file -->
		<vaultsetloginoptions user="${vault.user}" password="${vault.pw}" URL="${vault.host}" repository="${vault.repository}" />
		<vaultgetworkingfolderassignments append="false" identifier="v${version.new}" outputfile="${vault.workingfolderfile}" />
		
		<!-- Read the xml file's working folder paths into a delimited string -->
		<xmllist file="${vault.workingfolderfile}" property="vault.workingfolderlist" delim="," xpath="/root/vaultgetworkingfolderassignments/listworkingfolders/workingfolder/@reposfolder" />
		
		<!-- Loop each repository path in the list and remove its working folder association -->
		<foreach item="String" in="${vault.workingfolderlist}" delim=" ," property="vault.currentrepositorypath">
			<vaultremoveworkingfolder repositoryFolderPath="${vault.currentrepositorypath}" />
			<echo message="Removed working folder association from ${vault.currentrepositorypath}"/> 
		</foreach>
		
		<echo message="Done!"/>

	</target>

Code: Select all

<target name="GetLatest_Vault4" description="Gets the latest version of all files from Vault 4.04">
		<echo>
			Getting latest from Vault 4.04 with these settings:
			username:	${vault.user}
			password:	${vault.pw}
			host:		${vault.host}
			repository:	${vault.repository}
			path:		${vault.path}
			destination:${path.buildroot}
		</echo>
		
		<vaultsetloginoptions user="${vault.user}" password="${vault.pw}" URL="${vault.host}" repository="${vault.repository}" />
		<vaultsetworkingfolder repositoryFolderPath="${vault.path}" diskPath="${path.buildroot}" createDiskPath="true" />
		
		<vaultcheckout checkoutExclusive="true">
			<vaultfileset>
				<include name="${path.buildroot}" />
			</vaultfileset>
		</vaultcheckout>
		
		<echo message="Done!"/>
		
	</target>

Code: Select all

<target name="CommitChanges_Vault4" description="Commits build changes to Vault 4.04">

		<echo>
			Committing changes to Vault 4.04 with these settings:
			username:	${vault.user}
			password:	${vault.pw}
			host:		${vault.host}
			repository:	${vault.repository}
			path:		${vault.path}
			destination:${path.buildroot}
		</echo>

		<vaultsetloginoptions user="${vault.user}" password="${vault.pw}" URL="${vault.host}" repository="${vault.repository}" />
		<vaultsetworkingfolder repositoryFolderPath="${vault.path}" diskPath="${path.buildroot}" createDiskPath="false" />

		<vaultcheckin unchanged="UndoCheckout" localCopy="Leave">
			<vaultfileset>
				<include name="${path.buildroot}" />
			</vaultfileset>
		</vaultcheckin>
		
		<echo message="Done!"/>

	</target>

Code: Select all

<target name="LabelVersion_Vault4" description="Labels the build files in Vault 4.04">
		<echo>
			Labeling Vault 4.04 with these settings:
			username:	${vault.user}
			password:	${vault.pw}
			host:		${vault.host}
			repository:	${vault.repository}
			path:		${vault.path}
			destination:${path.buildroot}
		</echo>

		<vaultsetloginoptions user="${vault.user}" password="${vault.pw}" URL="${vault.host}" repository="${vault.repository}" />
		<vaultlabel objectPath="${vault.path}" labelName="v${version.new}" />
		
		<echo message="Done!"/>

	</target>
When I call nant using the EnterpriseBuild task, I get the following output from the CommitChanges_Vault4 task:

Code: Select all

CommitChanges_Vault4:

     [echo] 
     [echo]    Committing changes to Vault 4.04 with these settings:
     [echo]    username: build
     [echo]    password: build
     [echo]    host:  http://darwin/VaultService
     [echo]    repository: Main Repository
     [echo]    path:  $/trunk/Checkbox/Src
     [echo]    destination:C:\Development\Checkbox\Src
     [echo]   
     [echo] Done!
If I open the Vault client app, I can see all the files still checked out to the build user, with the changes listing in the pending change set.

When I call nant using the CommitChanges_Vault4 task (after running the build, so all the files are still checked out to my build user) It outputs this:

Code: Select all

CommitChanges_Vault4:

     [echo]
     [echo]    Committing changes to Vault 4.04 with these settings:
     [echo]    username: build
     [echo]    password: build
     [echo]    host:  http://darwin/VaultService
     [echo]    repository: Main Repository
     [echo]    path:  $/trunk/Checkbox/Src
     [echo]    destination:C:\Development\Checkbox\Src
     [echo]
[vaultcheckin] Preparing data to begin transaction
[vaultcheckin] Beginning transaction
[vaultcheckin]     Check in $/trunk/Checkbox/Src/ExceptionLogTool/AssemblyInfo.c

<snip>

[vaultcheckin] Undoing check out of file $/trunk/Checkbox/Src/Prezza.Framework.C
ommon/Tests/TestFixture.cs
     [echo] Done!

BUILD SUCCEEDED

shannon

Post by shannon » Wed Sep 19, 2007 10:46 am

Thank you for giving such an amazing amount of information. It always helps us to know exactly what's happening.

There is a known issue with calling vaultcheckin after vaultcheckout, somehow the checkout list isn't being refreshed properly. The workaround is to call vaultlistcheckouts before the call to vaultcheckin.

Give that a try and let me know if it works.

kkemp
Posts: 2
Joined: Wed Sep 19, 2007 10:09 am

Post by kkemp » Wed Sep 19, 2007 12:11 pm

Thanks for your help, adding the list checkouts task did the trick!

I have to say, overall these nant tasks for 4.04 leave a lot to be desired. Not being able to set comments with a check-in, having the inputs to get and checkin operations be the physical disk path instead of the Vault path, throwing exceptions for non-exception situations (e.g. setting a label that already exists), and the extreme verbosity of most operations make these taks quite a bear to work with.

shannon

Post by shannon » Wed Sep 19, 2007 12:24 pm

I'm glad it worked.

In response to your comments:

-both checkin and get should be able to take either a disk or repository path.
-vaultcheckin will have a comment attribute as of 4.0.5 (in the final testing phase now)

tomcat2001
Posts: 22
Joined: Fri Feb 20, 2004 10:35 am

Post by tomcat2001 » Tue Apr 15, 2008 10:58 am

I am on the 4.1. version of this and the problem still exists. Is this workaround still needed?
Lance Johnson

shannon

Post by shannon » Tue Apr 15, 2008 11:49 am

Yes

tomcat2001
Posts: 22
Joined: Fri Feb 20, 2004 10:35 am

Post by tomcat2001 » Tue Apr 15, 2008 11:51 am

k. thanks. I just wanted to make sure this wasn't something that was thought to be fixed.

I have found the vaultlistchangeset command to be much faster and also to allow the checkin to complete also.
Lance Johnson

ThomasC
Posts: 38
Joined: Mon Mar 12, 2007 3:20 pm

Vault Nant Tasks

Post by ThomasC » Thu Apr 17, 2008 6:26 pm

I second that working with the nant tasks is a bear. This is primarily due to the documentation. For example, the vaultlistchangeset docs states: "Returns the collection of change set items that are pending." The Sphinx (Mystery Men) would be proud of that sort of redundancy.

What exactly does that mean? Does it mean that it will do the equivalent of a get latest for all files that are different? If so, I'm also assuming that if the directory is empty that it will in essence do a get latest on the entire tree?

We are using nant through CC. Once of my build scripts simply logins into Vault and uses vaultget to retrieve a directory. These are the NantTimings:

vaultget - 00:26.76
vaultsetworkingfolder - 00:19.84
loadtasks - 00:00.65
vaultsetloginoptions - 00:00.02
echo - 00:00.00

Either it is the case that the login takes 19 seconds or setting the working folder takes 19 seconds. Either way, can anyone shed some light one A: which is the case and B: why said task is so slow?

ThomasC
Posts: 38
Joined: Mon Mar 12, 2007 3:20 pm

Set Working Folder is slow

Post by ThomasC » Thu Apr 17, 2008 6:36 pm

I'm going to guess, given other nant timings that the culprit is vaultsetworkingfolder. So, the question is why would that be so slow?

shannon

Post by shannon » Fri Apr 18, 2008 8:47 am

What version are you running?

ThomasC
Posts: 38
Joined: Mon Mar 12, 2007 3:20 pm

Versions

Post by ThomasC » Fri Apr 18, 2008 2:23 pm

We just upgraded from Vault 3.5 to Vault 4.1 and we are using Nant .85.

shannon

Post by shannon » Fri Apr 18, 2008 2:55 pm

Whichever task runs first will trigger the login, so that task will take a bit longer. If you call some op before setworkingfolder, that should tell you how long setworkingfolder takes without login.

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Fri May 30, 2008 3:29 pm

Vault 4.1.2 now handles calling vaultcheckin directly after calling vaultcheckout.
Subscribe to the Fortress/Vault blog

Post Reply