Merge pull request #30 from jmiller-afw/develop

Updates to provide installation of agent as a release agent
This commit is contained in:
Josh Wittner 2021-10-06 14:57:50 -07:00 коммит произвёл GitHub
Родитель 28f7201f9e 430338fbe6
Коммит bc151ff681
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 44 добавлений и 7 удалений

Просмотреть файл

@ -108,6 +108,15 @@ function Set-TargetResource {
[System.String]
$Pool = 'Default',
[System.String]
$DeploymentGroup = '',
[System.String]
$DeploymentGroupTags = '',
[System.String]
[string]$ProjectName = '',
[parameter(Mandatory = $true)]
[System.String]
$AgentDirectory,
@ -141,12 +150,15 @@ function Set-TargetResource {
if ( $Ensure -eq 'Present') {
$installArgs = @{
'Name' = $Name
'Pool' = $Pool
'ServerUrl' = $ServerUrl
'PAT' = $AccountCredential.Password
'AgentDirectory' = $AgentDirectory
'Replace' = $true
'Name' = $Name
'Pool' = $Pool
'ServerUrl' = $ServerUrl
'PAT' = $AccountCredential.Password
'AgentDirectory' = $AgentDirectory
'Replace' = $true
'DeploymentGroup' = $DeploymentGroup
'DeploymentGroupTags' = $DeploymentGroupTags
'ProjectName' = $ProjectName
}
if ( $Work ) { $installArgs['Work'] = $Work }
@ -189,6 +201,15 @@ function Test-TargetResource {
[System.String]
$Pool = 'Default',
[System.String]
$DeploymentGroup = '',
[System.String]
$DeploymentGroupTags = '',
[System.String]
[string]$ProjectName = '',
[parameter(Mandatory = $true)]
[System.String]
$AgentDirectory,

Просмотреть файл

@ -222,6 +222,15 @@ function Install-VSTSAgent {
[parameter(Mandatory = $false)]
[string]$Pool = 'Default',
[parameter(Mandatory = $false)]
[string]$DeploymentGroup = '',
[parameter(Mandatory = $false)]
[string]$DeploymentGroupTags = '',
[parameter(Mandatory = $false)]
[string]$ProjectName = '',
[parameter(Mandatory = $true)]
[securestring]$PAT,
@ -292,7 +301,14 @@ function Install-VSTSAgent {
if ( -not $configPath ) { throw "Agent $agentFolder is missing config.cmd" }
[string[]]$configArgs = @('--unattended', '--url', "$ServerUrl", '--auth', `
'pat', '--pool', "$Pool", '--agent', "$Name", '--runAsService')
'pat', '--agent', "$Name", '--runAsService')
if ($Pool) { $configArgs += '--pool', $Pool }
if ($DeploymentGroup) { $configArgs += '--deploymentgroup', '--deploymentgroupname', $DeploymentGroup }
if ($DeploymentGroupTags) { $configArgs += '--addDeploymentGroupTags', '--deploymentGroupTags', $DeploymentGroupTags }
if ($ProjectName) { $configArgs += '--projectname', $ProjectName }
if ( $Replace ) { $configArgs += '--replace' }
if ( $LogonCredential ) { $configArgs += '--windowsLogonAccount', $LogonCredential.UserName }
if ( $Work ) { $configArgs += '--work', $Work }