Chef Blogs

Integrate Chef into your Build and Release pipelines with Microsoft Visual Studio Team Services

Stuart Preston | Posted on | announcements | Chef InSpec | DevOps | events | partners | Products and Projects | release | Releases

Today, we are pleased to announce the first release of Chef Integration for Visual Studio Team Services, released to the Visual Studio Marketplace.

We know many of you are users of Visual Studio Team Services and have asked how to integrate Chef into your build and release pipeline, so we have brought you these tasks so that you can use the configuration management features of Chef Automate directly from within your Build and Release workflow.

After installing the extension into your account from the Marketplace, you will have a number of tasks available to you that perform key functions with the Chef platform:

Update cookbook version number: Allows you to take your current build number and set the version of a Chef cookbook with that version prior to uploading.

Upload cookbook to Chef Server: Allows you to specify a path containing a cookbook from within your repo, and have it uploaded to your Chef Server, along with all prerequisites if you have specified them.

Add variables to Chef environment: Using this task allows you to copy a set of VSTS Release Management variables for your Environment, over to a specified Chef environment.

Those variables are then available for you to use in your recipes.  For example, let’s say you had a variable called “connection_string”.  Using the defaults within the task allows you to access this variable from within a recipe by using the expression:

node["vsts_environment_variables"]["connection_string"]

Release cookbook version to environment: This task allows you to specify a version ‘pin’ for a Chef cookbook in a particular environment.  You can use this task in a Release Pipeline to ‘release’ cookbooks to that environment.

Access to Chef is provided by securely storing your client key in a Service Endpoint, this allows it to be reused across all tasks.

In software development, Release Management tools are typically workflow-based and in contrast, Chef is typically used to define and apply policy to machines.  In normal usage, you would have Chef periodically checking the servers for their configuration, checking for compliance, installing and configuring any necessary software and correcting any drift.  So how can we trigger a Chef Client run on a machine via a “push” mechanism?  Enter Deployment Groups – a new feature of VSTS Release Management.

Sam Guckenheimer announced the availability of Deployment Groups this morning at Microsoft’s Build Conference held in Seattle.  Deployment Groups provide a way to configure target machines with pull-based agents that communicate with VSTS.  So we now have a means of triggering Chef from inside a workflow rather than waiting for the next time Chef executes.

If using Microsoft Azure to host your deployment environment, the built in tasks that allow you to deploy an Azure Resource Manager (ARM) template to your subscription have been enhanced so that you can automatically deploy the Deployment Agent.

We have provided tasks to make it easy to execute Chef Client and perform some compliance testing using Chef’s open source compliance language and tooling, InSpec.  You can even publish the test results back to VSTS for full test traceability.

All of the tasks are compatible with the Hosted Build for Linux preview, as well as on private Build and Release agents. We know you will have some creative uses for these tasks and we look forward to hearing what you come up with!

To learn more about using Chef visit http://learn.chef.io

Chef is proud to be sponsoring Microsoft Build Conference this week so if you are lucky enough to be there in person feel free to stop by Booth 101 and talk to us about integrating your Build and release pipelines with Chef and Visual Studio Team Services!