-
Notifications
You must be signed in to change notification settings - Fork 837
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4723b6d
commit 4aa5a96
Showing
204 changed files
with
10,927 additions
and
13,358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
parameters: | ||
ServiceDirectory: '' | ||
|
||
steps: | ||
- pwsh: | | ||
$certUriPfx = "https://github.com/Azure/azure-sdk-tools/raw/main/tools/test-proxy/docker/dev_certificate/dotnet-devcert.pfx" | ||
$certUriCrt = "https://github.com/Azure/azure-sdk-tools/raw/main/tools/test-proxy/docker/dev_certificate/dotnet-devcert.crt" | ||
$certLocationPfx = "$(Build.SourcesDirectory)/dotnet-devcert.pfx" | ||
$certLocationCrt = "$(Build.SourcesDirectory)/dotnet-devcert.crt" | ||
Invoke-WebRequest ` | ||
-Uri $certUriPfx ` | ||
-OutFile $certLocationPfx -UseBasicParsing | ||
Invoke-WebRequest ` | ||
-Uri $certUriCrt ` | ||
-OutFile $certLocationCrt -UseBasicParsing | ||
dotnet dev-certs https --clean --import $certLocationPfx -p "password" | ||
Write-Host "##vso[task.setvariable variable=PROXY_CERT]$certLocationCrt" | ||
displayName: 'Download and Trust Certificate' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
param( | ||
[ValidateSet("start", "stop")] | ||
[String] | ||
$mode, | ||
[String] | ||
$targetFolder = "." | ||
) | ||
|
||
try { | ||
docker --version | Out-Null | ||
} | ||
catch { | ||
Write-Error "A invocation of docker --version failed. This indicates that docker is not properly installed or running." | ||
Write-Error "Please check your docker invocation and try running the script again." | ||
} | ||
|
||
$repoRoot = (Resolve-Path $targetFolder).Path.Replace("`\", "/") | ||
Write-Host $repoRoot | ||
|
||
$CONTAINER_NAME = "ambitious_azsdk_test_proxy" | ||
$IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-lin:1037115" | ||
$Initial = "" | ||
|
||
if ($IsWindows -and $env:TF_BUILD){ | ||
$IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-win:1037115" | ||
$Initial = "C:" | ||
} | ||
|
||
function Get-Proxy-Container(){ | ||
return (docker container ls -a --format "{{ json . }}" --filter "name=$CONTAINER_NAME" ` | ||
| ConvertFrom-Json ` | ||
| Select-Object -First 1) | ||
} | ||
|
||
if ($mode -eq "start"){ | ||
$proxyContainer = Get-Proxy-Container | ||
|
||
# if we already have one, we just need to check the state | ||
if($proxyContainer){ | ||
if ($proxyContainer.State -eq "running") | ||
{ | ||
Write-Host "Discovered an already running instance of the test-proxy!. Exiting" | ||
exit(0) | ||
} | ||
} | ||
# else we need to create it | ||
else { | ||
Write-Host "Attempting creation of Docker host $CONTAINER_NAME" | ||
Write-Host "docker container create -v `"${repoRoot}:${Initial}/etc/testproxy`" -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $IMAGE_SOURCE" | ||
docker container create -v "${repoRoot}:${Initial}/etc/testproxy" -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $IMAGE_SOURCE | ||
} | ||
|
||
Write-Host "Attempting start of Docker host $CONTAINER_NAME" | ||
docker container start $CONTAINER_NAME | ||
} | ||
|
||
if ($mode -eq "stop"){ | ||
$proxyContainer = Get-Proxy-Container | ||
|
||
if($proxyContainer){ | ||
if($proxyContainer.State -eq "running"){ | ||
Write-Host "Found a running instance of $CONTAINER_NAME, shutting it down." | ||
docker container stop $CONTAINER_NAME | ||
} | ||
} | ||
} |
Oops, something went wrong.