Chef Cookbook to install and manage Azure Pipelines Agent for Build and Release tasks
Перейти к файлу
Eammon Hanlon d31e2253e5
Merge pull request #44 from jasonwbarnett/remove-windows-cookbook-dependency
Remove windows dependency
2021-06-27 14:53:52 -07:00
.github Create greetings.yml 2020-07-04 09:24:31 -07:00
attributes Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
libraries Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
recipes Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
resources Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
templates/default Remove upgrade feature. Add env and path parameters. Bump agent version. Fix dependencies 2016-08-17 15:32:48 +02:00
test Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
.gitignore Add chef-solo test execution to test on azure devops 2018-09-13 23:29:45 -07:00
Berksfile Refactor lwrp into new style custom resources to address #13 (#18) 2017-11-26 23:33:02 -08:00
CHANGELOG.md Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-07-03 12:46:58 -07:00
CONTRIBUTING.md URL validation, improve macOS testing and testing guide (#8) 2017-05-25 21:10:47 -07:00
LICENSE Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
README.md Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
SECURITY.md Create SECURITY.md 2020-07-03 12:44:52 -07:00
TESTING.md Add support for deployment groups (#31) 2018-08-05 16:20:57 -07:00
chefignore Add chefignore. Add travis and supermarket badges 2016-01-22 21:43:51 +01:00
kitchen.yml Release 3.2: Add support for Proxy (#41) 2020-06-26 14:27:45 -07:00
metadata.rb Remove windows dependency 2021-04-28 14:16:36 -06:00
supermarket.pem.enc Add chef13 support (#5) 2017-05-03 15:42:48 -07:00

README.md

Visual Studio Team Services Build and Release Agent Cookbook

Join the chat at https://gitter.im/Microsoft/vsts-agent-cookbook Build Status Cookbook Version

Installs and configures Visual Studio Team Services Build and Release Agent

Please check Wiki for more examples

Requirements

  • Chef 12.5.0 or higher

Platforms

The following platforms are tested and supported:

  • Debian 8 x64 (Jessie)
  • Debian 9 x64 (Stretch)
  • Ubuntu 16.04 (Xenial Xerus)
  • Ubuntu 18.04 (Bionic)
  • Ubuntu 17.10 (Artful Aardvark)
  • CentOS 7
  • Windows 10
  • Windows Server 2012 R2
  • OS X 10.10.5
  • OS X 10.11.4

Attributes

  • node['vsts_agent']['binary']['version'] - set version of package to install
  • node['vsts_agent']['prerequisites']['redhat']['install'] - control dependencies installation for redhat based distros(redhat, centos etc.) . Default true
  • node['vsts_agent']['prerequisites']['debian']['install'] - control dependencies installation for debian based distros(debian, ubuntu etc.). Default true

Resource/Provider

vsts_agent

This resource installs and configures the vsts build and release agent

Actions

  • :install: Install and configure the agent
  • :remove: Remove the agent and unregister it from VSTS
  • :restart: Restart the agent service

Parameters

  • agent_name: name attribute. The name of the vsts agent
  • deploymentGroup: deploy the agent into the deployment group. Default 'false'
    • deploymentGroupName: name of the deployment group. Only applies if deploymentGroup==true
    • projectName: name of the vsts/tfs project where to deploy the agent. Only applies if deploymentGroup==true
    • collectionName: name of the vsts/tfs collection where to deploy the agent. Only applies if deploymentGroup==true. Dafault value is DefaultCollection
    • deploymentGroupTags: a comma-separated list of tags to set for the agent. Only applies if deploymentGroup==true
  • version: an agent version to install. Default version from an attribute
  • install_dir: A target directory to install the vsts agent
  • path: Overwrite system PATH environment variable values. Linux and macOS only
  • env: Additional environment variables. Linux and macOS only
  • user: Set a local user to run the vsts agent
  • group: Set a local group to run the vsts agent
  • runasservice: run agent as a service. Default 'true'
  • windowslogonaccount: Set a user name to run a windows service. Possible values are "NT AUTHORITY\NetworkService", "NT AUTHORITY\LocalService" or any system valid username
  • windowslogonpassword: Set password for windowslogonaccount unless it is equal to NetworkService or LocalService
  • vsts_url: url to VSTS instance
  • vsts_pool: A pool to connect an agent
  • vsts_auth: Authentication type. Default PAT auth. Valid options are:
    • PAT - Personal Access Token (requires vsts_token),
    • Negotiate - Kerberos or NTLM (requires vsts_username and vsts_password),
    • ALT - Alternate Credentials (requires vsts_username and vsts_password),
    • Integrated - Windows default credentials (doesn't require any credentials).
  • vsts_token: A personal access token for VSTS. Used with PAT auth type. See
  • vsts_username: A user to connect to VSTS. Used with Negotiate and ALT auth
  • vsts_password: A user to connect to VSTS. Used with Negotiate and ALT auth
  • work_folder: Set different workspace location. Default is "install_dir/_work"
  • proxy_url: Set the forward proxy (example value: http://192.168.1.1:8080)
  • proxy_sslcacert: Set the root certificate which is used for communicating through the forward proxy (example value: /usr/local/share/ca-certificates/Internal-CA.crt)

Examples

Install, configure, restart and remove a build agent. Check windows, linux or osx tests for more examples.

include_recipe 'vsts_agent::default'

if platform_family?('windows')
  dir = 'c:\\agents'
else
  dir = '/tmp/agents'
end

vsts_agent 'agent_01' do
  install_dir dir
  user 'vagrant'
  group 'vagrant'
  path '/usr/local/bin/:/usr/bin:/opt/bin/' # only works on nix systems
  env('M2_HOME' => '/opt/maven', 'JAVA_HOME' => '/opt/java') # only works on nix systems
  vsts_url 'https://contoso.visualstudio.com'
  vsts_pool 'default'
  vsts_token 'my_secret_token_from_vsts'
  windowslogonaccount 'builder' # will be used only on windows
  windowslogonpassword 'Pas$w0r_d' # will be used only on windows
  action :install
end

vsts_agent 'agent_01' do
  action :restart
end

vsts_agent 'agent_01' do
  vsts_token 'my_secret_token_from_vsts'
  action :remove
end

Install, configure, restart and remove a deployment agent.

vsts_agent 'deployment_agent_01' do
  install_dir dir
  deploymentGroup true
  deploymentGroupName 'project1-deployment-group'
  projectName 'project1'
  collectionName 'DefaultCollection'
  deploymentGroupTags "web, db"
  user 'vagrant'
  group 'vagrant'
  path '/usr/local/bin/:/usr/bin:/opt/bin/' # only works on nix systems
  env('M2_HOME' => '/opt/maven', 'JAVA_HOME' => '/opt/java') # only works on nix systems
  vsts_url 'https://contoso.visualstudio.com'
  vsts_token 'my_secret_token_from_vsts'
  windowslogonaccount 'builder' # will be used only on windows
  windowslogonpassword 'Pas$w0r_d' # will be used only on windows
  action :install
end

How to contribute

Check Contribution Guide and Testing Guide