Continuous integration using Vault command line

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
BSayatovic
Posts: 47
Joined: Thu Jun 25, 2009 12:02 pm

Continuous integration using Vault command line

Post by BSayatovic » Fri Sep 17, 2010 9:14 am

I'm developing a continuous-integration solution where I want to use the Vault command-line client to determine if a build is necessary, and if so, to build it.

The basic algorithm should work like this:
  • Look to see if anything has changed since last build
  • If so, get everything
  • Build it
The first part, "look to see if anything has changed" would sounds easy, but I'm getting tripped up. Given a repository path, like $/MyProject/trunk, how do I know if anything has changed since the last time I built?

Part of what's tripping me up is a poor understanding of Vault's terminology and behavior. For example, what's the difference between a "version" and an "objverid"? And how do those values get affected when I modify a folder? How about when I modify a file in the folder? And if I modify a file nested deep down in subfolders under that folder?

Ideally, I'd like to know what the latest revision of the project, get all content up to and including that revision, built it and record that revision. Next run, look to see if anything has changed since that revision. But without a better understanding of the above, I don't know how to piece that together with the vault commands.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Continuous integration using Vault command line

Post by Beth » Fri Sep 17, 2010 2:48 pm

I'm not sure how one would do that with just the command line client. I've been thinking on it, but don't have a solution yet that doesn't involve additional tools.

It's very common for our users to use 3rd party build tools. Here we use CC.NET, which is an open source solution: http://confluence.public.thoughtworks.o ... ontrol.NET. Other tools include nAnt and Ant. nAnt can be found here: http://nant.sourceforge.net/. Ant is here: http://ant.apache.org/.
Beth Kieler
SourceGear Technical Support

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Continuous integration using Vault command line

Post by Beth » Fri Sep 17, 2010 4:13 pm

Another way of doing this would be to use the Vault Client API, and run a VERSION history on $/. Compare that version with the last VERSION history from $/. If there is any change, ask for the Tx Details and go through the results from there.

Using the API may be more complex than a build tool though.
Beth Kieler
SourceGear Technical Support

GregM
Posts: 485
Joined: Sat Mar 13, 2004 9:00 am

Re: Continuous integration using Vault command line

Post by GregM » Fri Sep 17, 2010 6:10 pm

Here is the skeleton of our "CI using Vault command line" batch file.

Code: Select all

:BEGIN
 
vault.exe -host host -repository Repository get %VAULTPATH% -verbose -setfiletime current -merge overwrite > c:\temp\VaultDef.log
 
grep Fetched c:\temp\VaultDef.log
 
IF ERRORLEVEL 1 goto WAIT
 
:COMPILE
 
goto BEGIN

:WAIT
 
sleep 600

goto BEGIN

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Continuous integration using Vault command line

Post by Beth » Mon Sep 20, 2010 10:40 am

You'll need a user and password with your Vault command. Your idea isn't a bad one. It will really just depend on what you are using for the parts outside of the Vault command as to its feasibility.
Beth Kieler
SourceGear Technical Support

Post Reply