1 How to bootstrap a Linux VSTS build node using Chef in Azure
ivadim редактировал(а) эту страницу 2016-02-29 22:34:10 +01:00

First of all setup your environment by following next instruction Chef-development-environment-and-VSTS-account-setup

When your environment is ready you need to create a new cookbook which will install build tools and a VSTS build agent. You can use example cookbook as a reference.

git clone https://github.com/ivadim/linux-build-server-cookbook

If needed change recipes to your needs. And then upload the cookbook to the chef server using command

chef exec berks upload

Example cookbook uses VSTS credentials through Chef Data Bags. To create a new data bag with appropriate data use a command

knife data bag create users vsts

And when you are asked input next json and save a data bag (replace url, user and token with appropriate values)

{
  "id": "vsts",
  "vsts_url": "YourVSTSAccount.visualstudio.com",
  "vsts_user": "YourVSTSUser",
  "vsts_token": "Your_PAT",
}

Now everything is ready to bootstrap a first VSTS build agent using Chef. To do this just run a command

knife azure server create -N Ub1404Build --azure-vm-size Medium -I b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_3-LTS-amd64-server-20160119-en-us-30GB --bootstrap-protocol 'ssh' --ssh-port 22 -m 'West US' --ssh-user USERNAME --identity-file path\to\private_id_rsa -r 'recipe[linux-build-server]'

The command creates a 'Medium' 'Ub1404Build' node from a "Ubuntu-14_04_3-LTS-amd64-server-20160119-en-us-30GB" template in a 'West US' region. In most cases it's prefer to use template which already contains Visual Studio installation inside.

Re-run the command with a different dns name will scale your build agents number.