Added support for running the agent behind a web proxy (--proxyurl) for both the PS module and the DSC resource
This commit is contained in:
Родитель
cfc0376933
Коммит
df86a701f2
|
@ -131,6 +131,10 @@ function Set-TargetResource {
|
|||
[System.String]
|
||||
$Work,
|
||||
|
||||
[parameter(Mandatory = $false)]
|
||||
[System.String]
|
||||
[string]$ProxyUrl,
|
||||
|
||||
[parameter(Mandatory = $true)]
|
||||
[System.String]
|
||||
$ServerUrl,
|
||||
|
@ -171,6 +175,7 @@ function Set-TargetResource {
|
|||
|
||||
if ( $Work ) { $installArgs['Work'] = $Work }
|
||||
if ( $LogonCredential ) { $installArgs['LogonCredential'] = $LogonCredential }
|
||||
if ( $ProxyUrl ) { $installArgs['ProxyUrl'] = $ProxyUrl }
|
||||
|
||||
Install-VSTSAgent @installArgs
|
||||
}
|
||||
|
|
|
@ -111,7 +111,10 @@ function Find-VSTSAgent {
|
|||
[switch]$Latest,
|
||||
|
||||
[parameter(Mandatory = $false)]
|
||||
[string]$Platform
|
||||
[string]$Platform,
|
||||
|
||||
[parameter(Mandatory = $false)]
|
||||
[string]$ProxyUrl
|
||||
)
|
||||
|
||||
if ( $Latest ) {
|
||||
|
@ -243,6 +246,10 @@ function Install-VSTSAgent {
|
|||
[parameter(Mandatory = $true)]
|
||||
[uri]$ServerUrl,
|
||||
|
||||
[parameter(Mandatory = $false)]
|
||||
[ValidateScript({ $_ -match "http://\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}:\d{1,5}" })]
|
||||
[string]$ProxyUrl,
|
||||
|
||||
[parameter(Mandatory = $false)]
|
||||
[switch]$Replace,
|
||||
|
||||
|
@ -271,6 +278,7 @@ function Install-VSTSAgent {
|
|||
if ( $MinimumVersion ) { $findArgs['MinimumVersion'] = $MinimumVersion }
|
||||
if ( $MaximumVersion ) { $findArgs['MaximumVersion'] = $MaximumVersion }
|
||||
if ( $RequiredVersion ) { $findArgs['RequiredVersion'] = $RequiredVersion }
|
||||
if ( $ProxyUrl ) { $findArgs['ProxyUrl'] = $ProxyUrl }
|
||||
|
||||
$agent = Find-VSTSAgent @findArgs | Sort-Object -Descending -Property Version | Select-Object -First 1
|
||||
if ( -not $agent ) { throw "Could not find agent matching requirements." }
|
||||
|
@ -319,6 +327,7 @@ function Install-VSTSAgent {
|
|||
|
||||
if ( $Replace ) { $configArgs += '--replace' }
|
||||
if ( $LogonCredential ) { $configArgs += '--windowsLogonAccount', $LogonCredential.UserName }
|
||||
if ( $ProxyUrl ) { $configArgs += '--proxyurl', $ProxyUrl }
|
||||
if ( $Work ) { $configArgs += '--work', $Work }
|
||||
|
||||
if ( -not $PSCmdlet.ShouldProcess("$configPath $configArgs", "Start-Process") ) { return }
|
||||
|
|
Загрузка…
Ссылка в новой задаче