HodorNV / ALOps

ALOps
59 stars 24 forks source link

Dynamic selection of supported isolation #488

Closed kasperdj closed 1 month ago

kasperdj commented 2 years ago

Describe the bug We have 3 build servers with Intel Xeon E5-2620 v3 CPU runing Windows Server 2019. These servers requires hyper-v isolation and are working perfectly.

We now have an additional build server being added to the Agent Pool. This build server is on a different CPU architecture, AMD EPYC 7402P , and are running Windows Server 2022. This server does not support hyper-v isolation as it's an AMD CPU. We can manually create a docker container with proces isolation directly on the new server and this works.

The issue: how do I dynamically control the isolation handling in the ALOpsDockerStart parameters? If this is not possible, is there an alternative way to control that if a build is running on build server a, b or c then use hyper-v isolation but if running on build server d, then use proces isolation instead.

the used yaml please provide the yaml that you used. It helps you put the yaml like this:

- task: ALOpsDockerStart@1
  inputs:
    docker_pull: false
    accept_image_eula: true
    accept_image_outdated: true
    docker_parameters: '--isolation=hyperv --env customNavSettings=EnableTaskScheduler=False'
    memory_gb: 16  

the output Also the complete output is necessary for us to see what is going on. Also use backtics:

your output log

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. You can easily paste them in here.

Additional context Add any other context about the problem here.

waldo1001 commented 2 years ago

Hm, not that I know of. All I can think of is to introduce a new step all in the beginning (powershell), where you figure out which server - and depending on which, you can update a variable that you can use in the docker_parameters?

🤔

kasperdj commented 2 years ago

Damn...you do not have an "unofficial" way of letting the system decide which isolation to use like the -useBestContainerOS in BCContainerHelper?

kasperdj commented 2 years ago

We will try to implement something like the snippet below and pass this as a parameter to ALOpsDockerStart

` $release = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId $ver = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name DisplayVersion).DisplayVersion $version = If ($release -eq '2009') {$ver} Else {$release}

if ($version -eq '21H2') { $isolation = "process" } else { $isolation = "hyperv" } `

waldo1001 commented 2 years ago

I'll reopen this because I'd like to talk this through with the developer when he's back ..

waldo1001 commented 2 years ago

I took it up with Development. The problem here is that there are 2 differences: CPU is different, AND OS is different. Therefor, "useBestContainerOS" is a mere coincidence that it works in this case - but if you would have installed 2019 on your EPYC, it wouldn't have worked (assumption).

All-in-all, it'd be complicated, but we have some ideas that COULD work. So .. it's on the list to investigate.