Docker/go.ps1
[CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $PAT, [Parameter(Mandatory = $true)] [string] $ADOOrg, [Parameter(Mandatory = $true)] [string] $ADOProject, [Parameter(Mandatory = $false)] [string] $ADOPool = "PowerPlatform", [Parameter(Mandatory = $false)] [bool] $RebuildBase = $false ) $CurrentLocation = Get-Location Set-Location $PSScriptRoot #Remove-Item .\Microsoft.PowerPlatform.DevOps\ -Recurse -Force -ErrorAction SilentlyContinue #Copy-Item -Path (Get-Item '..\*.*' -Exclude ('Docker')).FullName -Destination .\Microsoft.PowerPlatform.DevOps\ -Recurse -Force if (!(Test-Path -Path c:\Dev\Repos)) { New-Item -Path C:\Dev\Repos -ItemType Directory } $imageResult = docker image ls microsoft.powerplatform.devops.base --quiet if (!$imageResult -or $RebuildBase) { Write-Host "Building base image...." docker build -t microsoft.powerplatform.devops.base:latest . -f Dockerfile.devopsbase } docker build -t microsoft.powerplatform.devops.test:latest --no-cache . $ScriptBlock = { function Agent([string]$Agent) { start-sleep -Seconds 5 #docker exec -it $Agent powershell Invoke-PowerPlatformDevOps docker exec -it $Agent powershell \Agent.ps1 } function Tooling([string]$Agent) { start-sleep -Seconds 5 docker exec -it $Agent powershell -NoExit -File ".\Tooling.ps1" "true" } } if (docker ps -a -q -f name=$ADOOrg) { if (docker ps -q -f name=$ADOOrg) { Start-Process -FilePath PowerShell -ArgumentList "-Command & {$ScriptBlock Tooling('$ADOOrg')}" Start-Process -FilePath PowerShell -ArgumentList "-Command & {$ScriptBlock Agent('$ADOOrg')}" } else { Start-Process -FilePath PowerShell -ArgumentList "-Command & {$ScriptBlock Tooling('$ADOOrg')}" Start-Process -FilePath PowerShell -ArgumentList "-Command & {$ScriptBlock Agent('$ADOOrg')}" docker start $ADOOrg } } else { Start-Process -FilePath PowerShell -ArgumentList "-Command & {$ScriptBlock Tooling('$ADOOrg')}" Start-Process -FilePath PowerShell -ArgumentList "-Command & {$ScriptBlock Agent('$ADOOrg')}" docker run -t -d --name $ADOOrg -e AZP_AGENT_NAME=$ADOOrg -e AZP_TOKEN=$PAT -e AZP_ORG=$ADOOrg -e AZP_PROJECT=$ADOProject -e AZP_POOL=$ADOPool -v c:\dev\repos:c:\dev\repos microsoft.powerplatform.devops.test:latest } |