问题
I have a need to merge changes from one branch to a release branch and only deploy these changed files to a production environment. these files are Maestro and SQL files, so there is no "build", just individual files that need to be moved. this process is all manual and I would like to automate this process using TFS 2015 CI builds and/or Release Management vNext 2015 Update2.
My main issue is how to identify the files changed. Using the build agent workspace is not reliable as the time stamps on the files is set when doing getlatest.
I believe the most reliable way of identifying changed files is by looking at the merge changeset and getting that list of files and scripting out a custom package to move to production.
Has anyone else solved this problem and if so how did you do it?
thx
回答1:
One would not need/want to use file datestamps to get this type of info, as you say it would be unreliable.
1. TF FolderDiff can accomodate the first (diff) portion of your scenario: https://msdn.microsoft.com/en-us/library/bb385992(v=vs.140).aspx
2. TF Merge can accomodate the second (merge) portion of your scenario. https://msdn.microsoft.com/en-us/library/bd6dxhfy.aspx
3. It is likely that one would need to wrap this in a controlling script (PowerShell perhaps) and invoke from the build process
Here are some general examples of wrapping TF commands in PowerShell:
Expand output of TF.exe results from PowerShell
External:
http://www.tomsitpro.com/articles/how-to-commit-code-tfs-powershell,2-990.html
https://github.com/adbertram/Random-PowerShell-Work/blob/master/TFS/TFSClientFunctions.ps1
回答2:
I would recommend that you deploy the entire application on each deployment, however there are actions that you can take too minimise the time taken to run the deploy.
If you are deploying SQL then consider using a folder with numbered scripted and record the last run number in the database. There are tools like ReadyRoll and SSW SQL Deploy that can help automate this, but ultimately this is easily solved.
For asset files like images and other binaries you will need to do a date stamp compare.
来源:https://stackoverflow.com/questions/35730175/how-to-identify-files-that-have-changed-during-tfs-build-2015