Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to the Proxy Handling #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tasks/detect-task/detect-task.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ foreach ($AdditionalArgument in $ParsedArguments){
Write-Host "Downloading detect powershell library"
$DetectDownloadSuccess = $false;
try {
if ($UseProxy -eq $true){
$ProxyCreds = New-Object System.Management.Automation.PSCredential(
${Env:blackduck.hub.proxy.username},
(ConvertTo-SecureString ${Env:blackduck.hub.proxy.password} -AsPlainText -Force)
);
Invoke-RestMethod https://blackducksoftware.github.io/hub-detect/hub-detect.ps1?$(Get-Random) -Proxy ${Env:blackduck.hub.proxy.host}":"${Env:blackduck.hub.proxy.port} -ProxyCredential $ProxyCreds | Invoke-Expression;
} else {
Invoke-RestMethod https://blackducksoftware.github.io/hub-detect/hub-detect.ps1?$(Get-Random) | Invoke-Expression;
}
$DetectDownloadSuccess = $true;
} catch [Exception] {
Write-Host ("Failed to download the latest detect powershell library from the web. Using the embedded version.")
Expand Down
3 changes: 1 addition & 2 deletions tasks/detect-task/lib/detect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ function Get-ProxyInfo () {
Write-Host "Skipping proxy, no host found."
}else{
Write-Host "Found proxy host."
$ProxyUrlBuilder = New-Object System.UriBuilder
$ProxyUrlBuilder.Host = $ProxyHost
$ProxyUrlBuilder = [UriBuilder]($ProxyHost)

$ProxyPort = ${Env:blackduck.hub.proxy.port};

Expand Down