Update README, implement pool name
This commit is contained in:
Родитель
610e571859
Коммит
b0e6ba74d5
|
@ -27,8 +27,9 @@ suites:
|
|||
inspec_tests:
|
||||
- test/smoke/default
|
||||
attributes:
|
||||
vsts-agent:
|
||||
vsts_agent:
|
||||
admin_user: admin
|
||||
agent_pool: ApexInfra macOS
|
||||
homebrew:
|
||||
auto-update: false
|
||||
owner: admin
|
||||
|
|
45
README.md
45
README.md
|
@ -1,8 +1,11 @@
|
|||
# VSTS Agent Cookbook for macOS
|
||||
VSTS Agent Cookbook for macOS
|
||||
=============================
|
||||
|
||||
## Attributes
|
||||
Attributes
|
||||
----------
|
||||
|
||||
### Agent Name
|
||||
|
||||
The name of the agent.
|
||||
|
||||
**Default value:** `node['hostname']`
|
||||
|
@ -12,6 +15,7 @@ default['vsts_agent']['agent_name']
|
|||
```
|
||||
|
||||
### Agent Version
|
||||
|
||||
The version of the agent to install.
|
||||
|
||||
**Default value:** `'latest'`
|
||||
|
@ -20,45 +24,64 @@ The version of the agent to install.
|
|||
default['vsts_agent']['version']
|
||||
```
|
||||
|
||||
### VSTS Agent Pool
|
||||
|
||||
The name of the agent pool you wish to add the agent to.
|
||||
|
||||
**Default value:** `'ApexInfra macOS'`
|
||||
|
||||
```ruby
|
||||
default['vsts_agent']['agent_pool']
|
||||
```
|
||||
|
||||
### VSTS Account Name
|
||||
The name of your VSTS account. You **must** set this attribute if you are not a member of the "Office" account.
|
||||
|
||||
The name of your VSTS account. You **must** set this attribute if you are not a
|
||||
member of the "Office" account.
|
||||
|
||||
**Default value:** `'office'`
|
||||
|
||||
```ruby
|
||||
default['vsts_agent']['account']
|
||||
```
|
||||
|
||||
### Admin User
|
||||
|
||||
The username of an adminstrator on the macOS system.
|
||||
|
||||
**Default value:** `'vagrant'`
|
||||
|
||||
```ruby
|
||||
default['vsts_agent']['admin_user']
|
||||
```
|
||||
|
||||
### VSTS Agent Home directory
|
||||
|
||||
The location where containing all of the VSTS builds, sources, etc.
|
||||
|
||||
**Default value:** `'/Users/node['vsts_agent']['admin_user']/vsts-agent'`
|
||||
|
||||
```ruby
|
||||
default['vsts_agent']['agent_home']
|
||||
```
|
||||
|
||||
### Additional Environment Variables
|
||||
An optional hash may be set to pass environment variables to the agent. The agent will then
|
||||
be configured with these environment variables which it will then report back to
|
||||
the server.
|
||||
|
||||
An optional hash may be set to pass environment variables to the agent. The agent
|
||||
will then be configured with these environment variables which it will then
|
||||
report back to the server.
|
||||
|
||||
**Default value:** `{}`
|
||||
|
||||
```ruby
|
||||
default['vsts_agent']['additional_environment']
|
||||
```
|
||||
|
||||
## Required Data Bag
|
||||
Required Data Bag Item
|
||||
----------------------
|
||||
|
||||
For now, you'll need to create a data bag called 'vsts' with a bag item called
|
||||
'build_agent' that contains two keys used to configure the agent:
|
||||
|
||||
For now, you'll need to create a data bag called 'vsts' with a bag item called 'build_agent' that contains three keys:
|
||||
- `personal_access_token`
|
||||
- `agent_pool_name`
|
||||
- `account_url`
|
||||
|
||||
The three keys will be used to configure the agent.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
default['vsts_agent']['agent_name'] = node['hostname']
|
||||
default['vsts_agent']['version'] = 'latest'
|
||||
default['vsts_agent']['agent_name'] = node['hostname']
|
||||
default['vsts_agent']['account'] = 'office'
|
||||
default['vsts_agent']['admin_user'] = 'vagrant'
|
||||
default['vsts_agent']['agent_pool'] = 'Hosted macOS Preview'
|
||||
default['vsts_agent']['additional_environment'] = {}
|
||||
|
||||
default['vsts_agent']['admin_user'] = 'vagrant'
|
||||
|
|
|
@ -4,7 +4,7 @@ maintainer_email 'eric.hanko1@gmail.com'
|
|||
license 'MIT'
|
||||
description 'A dedicated cookbook for configuring a VSTS build/release agent on macOS.'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.1.4'
|
||||
version '0.1.6'
|
||||
chef_version '~> 13.0' if respond_to?(:chef_version)
|
||||
|
||||
depends 'homebrew'
|
||||
|
|
|
@ -23,6 +23,10 @@ action_class do
|
|||
"/Users/#{admin_user}"
|
||||
end
|
||||
|
||||
def account_name
|
||||
node['vsts_agent']['account']
|
||||
end
|
||||
|
||||
def vsts_environment
|
||||
default_environment.merge(additional_environment)
|
||||
end
|
||||
|
@ -36,13 +40,13 @@ action_class do
|
|||
{ VSTS_AGENT_INPUT_URL: agent_data[:account_url],
|
||||
VSTS_AGENT_INPUT_AUTH: 'PAT',
|
||||
VSTS_AGENT_INPUT_TOKEN: agent_data[:personal_access_token],
|
||||
VSTS_AGENT_INPUT_POOL: agent_data[:agent_pool_name],
|
||||
VSTS_AGENT_INPUT_POOL: node['vsts_agent']['agent_pool'],
|
||||
VSTS_AGENT_INPUT_AGENT: node['vsts_agent']['agent_name'],
|
||||
HOME: admin_home }
|
||||
end
|
||||
|
||||
def launchd_plist
|
||||
"#{admin_library}/LaunchAgents/vsts.agent.office.#{agent_name}.plist"
|
||||
"#{admin_library}/LaunchAgents/vsts.agent.#{account_name}.#{agent_name}.plist"
|
||||
end
|
||||
|
||||
def agent_needs_update?
|
||||
|
@ -149,7 +153,7 @@ action :install_service do
|
|||
mode 0o775
|
||||
end
|
||||
|
||||
directory "#{admin_library}/Logs/vsts.agent.office.#{agent_name}" do
|
||||
directory "#{admin_library}/Logs/vsts.agent.#{account_name}.#{agent_name}" do
|
||||
recursive true
|
||||
owner admin_user
|
||||
group 'admin'
|
||||
|
@ -172,17 +176,17 @@ action :install_service do
|
|||
action :create
|
||||
end
|
||||
|
||||
launchd "vsts.agent.office.#{agent_name}" do
|
||||
launchd "vsts.agent.#{account_name}.#{agent_name}" do
|
||||
path launchd_plist
|
||||
type 'agent'
|
||||
owner admin_user
|
||||
label "vsts.agent.office.#{agent_name}"
|
||||
label "vsts.agent.#{account_name}.#{agent_name}"
|
||||
program_arguments ["#{agent_home}/bin/runsvc.sh"]
|
||||
username admin_user
|
||||
working_directory agent_home
|
||||
run_at_load true
|
||||
standard_out_path "#{admin_library}/Logs/vsts.agent.office.#{agent_name}/stdout.log"
|
||||
standard_error_path "#{admin_library}/Logs/vsts.agent.office.#{agent_name}/stderr.log"
|
||||
standard_out_path "#{admin_library}/Logs/vsts.agent.#{account_name}.#{agent_name}/stdout.log"
|
||||
standard_error_path "#{admin_library}/Logs/vsts.agent.#{account_name}.#{agent_name}/stderr.log"
|
||||
environment_variables VSTS_AGENT_SVC: '1'
|
||||
session_type 'user'
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче