Managing builds through Command Line
Before Beta3, builds could be fired only through the UI. Now a command line alternative is available. The command line tool also provides options to stop and delete a build. The latter functionality is not available through the UI. The tool provides a command line help which explains the parameters required by the commands. This blog attempts to cover this new functionality.
Start
Starting a build requires START_BUILD permissions. Scenarios where you might want to use the command line to start a build are:-
- You want to integrate kicking off a build into your workflow; where build might be just one of the steps.
- You want builds to be kicked off at regular intervals of time. You could use the Windows scheduler and the command line interface to accomplish this.
- You might want to extend the functionality of the TFSBuild system provided. An example is writing a system for continuous integration.
- You just love working on the console:). A simple telnet to the office from home would enable you to do the needful.
D:Program FilesMicrosoft Visual Studio 8Common7IDE>TFSBuild.exe start https://btnhydbb03:8080 MyTestTeamProject MyTestTeamBuildType
Microsoft (R) TfsBuild Version 8.0.0.0
for Microsoft (R) Visual Studio 2005 Team System
Copyright (C) Microsoft Corporation 2004. All rights reserved.
Build number: MyTestTeamBuildType_20050926.2
Initializing build
Getting sources
Compiling sources
Compiling ConsoleApplication1.sln for Any CPU/Release
Compiling ConsoleApplication1.csproj
Compiling TestProject1.sln for Any CPU/Release
Compiling TestProject1.csproj
Compiling WindowsApplication1.sln for Any CPU/Release
Compiling WindowsApplication1.csproj
Getting changesets and updating work items
Running tests
Running tests for Any CPU/Release
Copying binaries to drop location
Copying log files to drop location
Successfully Completed
Dump 1 Command line start console output
Compare this with the build report shown through the UI:-
- In the console output for the build; only the build steps are shown and the "Completed On" time for these steps is not shown. The idea is that when you are using the command line build; your main intent is to fire the build and nothing else.
- If you want to change the quality of the build or view the time taken for each build step you would have to go to the UI. For viewing other stuff such as change sets and work items; you could look up the Buildlog.txt in the drop share.
Stop
A user starting the build or having ADMIN_BUILD permission can only stop the build.
- To stop a currently running build use this functionality.
- "Stopping" the build would kill the build process on the build machine and mark the status of the build as "Stopped".
- The event log on the AT has an entry per build stopped containing data about the user who stopped the build and the time when the build was stopped.
- There is no way to resume or unstop a stopped build.
D:Program FilesMicrosoft Visual Studio 8Common7IDE>tfsBuild stop https://btnhydbb03:8080 MyTestTeamProject MyTestTeamBuildType_20050926.3 /noprompt
Microsoft (R) TfsBuild Version 8.0.0.0
for Microsoft (R) Visual Studio 2005 Team System
Copyright (C) Microsoft Corporation 2004. All rights reserved.
Stopping MyTestTeamBuildType_20050926.3... Done
Dump 2 Command line stop console output
Delete
ADMIN_BUILD permissions are required to delete a build. Deleting a build having tests enabled also requires PUBLISH_BUILD permisssions.
- Used for removing unneeded builds from the system
- Can delete multiple builds from the same Team Project on a single invocation.
- A delete on an ongoing build is not supported.
- Deleting a build entails deleting the entries for that build from the database and removing the binaries for that build from the drop location.
- Deleting the most recent build from a team project would cause the next build to have the same build number as the deleted build.
- Again an entry per deleted build is logged in the event log at the AT.
D:Program FilesMicrosoft Visual Studio 8Common7IDE>tfsBuild delete https://btnhydbb03:8080 MyTestTeamProject MyTestTeamBuildType_20050926.1 MyTestTeamBuildType_20050926.3 /noprompt
Microsoft (R) TfsBuild Version 8.0.0.0
for Microsoft (R) Visual Studio 2005 Team System
Copyright (C) Microsoft Corporation 2004. All rights reserved.
Deleting MyTestTeamBuildType_20050926.1... Done
Deleting MyTestTeamBuildType_20050926.3... Failed
The path is not of a legal form.
Dump 3 Command line delete console output
The failure to delete the last build is a known issue in Beta3 bits. This happens when a build that was stopped in the "Initializing Build" step is attempted to be deleted. The build has been deleted from the database; but not from the drop location. The workaround is to manually delete the folder from the drop share.
About Me
I have been at Microsoft for just over an year in the discipline of Test. Reading fiction is one of my hobbies that is still alive:-). I am onto "The Fountainhead" these days. Puzzleses excite me; and nothing is more attractive than what eludes me. Writing blogs is out of that elusive list now:-)