Skip to content

azure devops pipelines

Russell Seymour edited this page Jan 27, 2020 · 1 revision

Azure DevOps Pipeline YAML File

The tasks in the Chef extension can be configured in an Azure DevOps pipeline yaml file.

Fully Qualified Names

In order to use the tasks in such a file the correct fully qualified name is required.

Task Name Pipeline File name
Add variables to Chef environment chef-software.vsts-chef-tasks.vsts-chef-tasks-environment-vsts-variables.vsts-chef-task-env-vsts-variables@1
Cookbook Linting chef-software.vsts-chef-tasks.vsts-chef-task-linting.vsts-chef-task-lintin@1
Execute Chef Client chef-software.vsts-chef-tasks.vsts-chef-tasks-exec-chef-client.vsts-chef-task-exec-chef-client@1
Execute InSpec chef-software.vsts-chef-tasks.vsts-chef-tasks-exec-inspec.vsts-chef-task-exec-inspec@1
Execute Knife chef-software.vsts-chef-tasks.vsts-chef-task-exec-knife.vsts-chef-task-exec-knife@1
Install ChefDK chef-software.vsts-chef-tasks.vsts-chef-task-install-chefdk.vsts-chef-task-install-chefdk@1
Install Cookbook Gems chef-software.vsts-chef-tasks.vsts-chef-task-cookbook-gems.vsts-chef-task-cookbook-gems@1
Install Gem chef-software.vsts-chef-tasks.vsts-chef-task-gem-install.vsts-chef-task-gem-install@1
Install InSpec chef-software.vsts-chef-tasks.vsts-chef-task-install-inspec.vsts-chef-task-install-inspec@1
Publish cookbook to Supermarket chef-software.vsts-chef-tasks.vsts-chef-task-cookbook-publish-supermaket.vsts-chef-task-cookbook-publish-supermaket@1
Release cookbook version to environment chef-software.vsts-chef-tasks.vsts-chef-tasks-environment-cookbook-version-constraint.vsts-chef-task-env-version-constraint@1
Test Kitchen chef-software.vsts-chef-tasks.vsts-chef-task-test-kitchen.vsts-chef-task-test-kitchen@1
Update cookbook version number chef-software.vsts-chef-tasks.vsts-chef-tasks-cookbook-version.vsts-chef-task-cookbook-version@1
Upload cookbook to Chef server chef-software.vsts-chef-tasks.vsts-chef-tasks-cookbook-upload.vsts-chef-task-cookbook-upload@1

NOTE: The @1 in the fully qualified name denotes the major version of the extension to use.

Example

The following YAML file is an example of how the tasks can be used to:

  • Ensure ChefDK is installed
  • Install Cookbook gems
  • Run Test Kitchen
  • Upload the cookbook to the Chef server
steps:
- task: chef-software.vsts-chef-tasks-preview.vsts-chef-task-install-chefdk.vsts-chef-task-install-chefdk-preview@1
  displayName: 'Install ChefDK'

- task: chef-software.vsts-chef-tasks-preview.vsts-chef-task-cookbook-gems.vsts-chef-task-cookbook-gems-preview@1
  displayName: 'Install Cookbook Gems'

- task: chef-software.vsts-chef-tasks-preview.vsts-chef-task-test-kitchen.vsts-chef-task-test-kitchen-preview@1
  displayName: 'Execute Test Kitchen: verify'
  inputs:
    tkAzureEndpoint: 'My Azure Subscription'

- task: chef-software.vsts-chef-tasks-preview.vsts-chef-tasks-cookbook-upload.vsts-chef-task-cookbook-upload-preview@1
  displayName: 'Upload cookbook to Chef Server'
  inputs:
    chefServerEndpoint: 'Chef Server Connection'