We are using TFSDeployer to listen to build quality changes and deploy to our staging environment when it transitions to ‘Staging’.
I’d like to have it go ahead and update all of the other builds that have a currently build quality of ‘Staging’ to be ‘Rejected’.
This appears to be something that needs to happen inside the PowerShell script which looks like:
$droplocation = $TfsDeployerBuildData.DropLocation ECHO $droplocation $websourcepath = $droplocation + '\Release\_PublishedWebsites\CS.Public.WebApplication\' $webdestinationpath = '\\vmwebstg\WebRoot\CreditSolutions\' new-item -force -path $webdestinationpath -itemtype 'directory' get-childitem $webdestinationpath | remove-item -force -recurse get-childitem $websourcepath | copy-item -force -recurse -destination $webdestinationpath $configFile = $webdestinationpath + 'web.development.config' remove-item $configFile -force $configFile = $webdestinationpath + 'web.staging.config' $configFileDest = $webdestinationpath + 'web.config' move-item $configFile $configFileDest -force
So, how can I do this?
First add the Get-tfs function to your script:
Next, instantiate the TFS object
Then find the builds with a build quality of ‘Staging’
Finally, update the quality of these builds
(I haven’t run this script yet, but you should be able to get it going without troubles)
More info on my blog: Using the Team Foundation Object Model with PowerShell
One last advice, if you update the Build quality from within the script that is running from TfsDeployer, you could end up with 2 script running at the same time if you have a mapping for the Staging –> Rejected transition!