To do this from Vault, integrate the two command line client commands below into your build script. The parameters assume you are applying the label "My Label" to the Vault folder "$/Automated Tests" in a Vault Repository called "QA" and your build process looks for source files in "C:\builds\sourcetree". Also, your vault server is located at vault.company.com
Code: Select all
vault label -host vault.company.com -user "Build User" -password "MyPassword" -repository "QA" "$/Automated Tests" "My Label"
Code: Select all
vault getlabel -host vault.company.com -user "Build User" -password "MyPassword" -repository "QA" -destfolder "C:\builds\sourcetree" "$/Automated Tests" "My Label"
If your build script is in Perl, it might look something like this:
Code: Select all
$labelname = "Build $buildMajor.$buildMinor.$buildRev.$buildnum";
runprog( qq(vault label -host ${Vault_Server} -user ${Vault_User} -password ${Vault_Password} -repository "${Vault_Repository}" "$Config->{'SrcDir'}" "$labelname") );
runprog( qq(vault getlabel -host ${Vault_Server} -user ${Vault_User} -password ${Vault_Password} -repository "${Vault_Repository}" -destfolder ${BuildDir} "$Config->{'SrcDir'}" "$labelname") );
sub runprog
{
my($progstr) = @_;
output("EXECUTING " . ${progstr});
open(DEBUG, ${progstr} . ' |');
while(<DEBUG>)
{
print;
}
close(DEBUG);
}