Back to Top

Executing a Command Line Utility During Deployment in BuildMaster

When developing software, it is common to incorporate external command-line tools as a part of the build and deployment process. BuildMaster facilitates this need and allows for automatic execution of a command line utility on a remote build server.


With BuildMaster you can perform the minification process during an automated build. Using an Execute Process operation as part of a deployment plan, we can take advantage of the Microsoft Ajax Minifier tool and minify JavaScript.

Step 1: Prepare the Remote Server

Have the ajaxmin executable and a website with the script to be minified already on the remote server (usually previous operations in your BuildMaster deployment plan would have put them there):

PowerShell

Step 2: Add the Execute Process Operation to the Deployment Plan

First, create a General block so that server context can be set (server context can also be set in the pipeline). In this case the server is VM-BMCP-1A.

Next add the Execute Process operation adding the file name, arguments, and directory.

Command Line Action

Step 3: Save to the Deployment Plan

Once saved , every time the build is executed, the example.js file will be minified into example.min.js.

Note that in this example, two separate file names are used simply to compare the results, but you may wish to use the same file name for the output file so that you do not have to modify any script tags in your web site. Here is a comparison of the files:

Diffs

It's worth mentioning that BuildMaster will log all stdout and stderr messages (and if configured, fail the build if stderr is written to).

Using the Execute Process operation, it is trivial to automate a variety of deployment tasks. Some other common examples include:

  • A Code Signing tool that digitally signs your executables before they are published
  • A utility that builds an installer
  • Any source control system, unit testing framework, or build tool that we do not already integrate with directly
  • Any custom tool used by your organization