-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
1ES Hosted Pools #3054
Merged
StephanTLavavej
merged 29 commits into
microsoft:main
from
StephanTLavavej:1es-hosted-pools
Aug 26, 2022
Merged
1ES Hosted Pools #3054
StephanTLavavej
merged 29 commits into
microsoft:main
from
StephanTLavavej:1es-hosted-pools
Aug 26, 2022
Conversation
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
…ar -Status`. If we display 1/N as we begin the 1st task, we should display N/N as we begin the Nth task.
We don't need to worry about running the creation script twice in a single minute.
`$LiveVMPrefix` was only needed for `Set-AzVmssOsProfile`. Azure CLI (`az`) was only needed for VMSS diagnostic logs. We'll be replacing `New-AzImageConfig` and `New-AzImage` with an Azure Compute Gallery.
CaseyCarter
approved these changes
Aug 25, 2022
strega-nil-ms
suggested changes
Aug 25, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name is the important bit to me (otherwise, this looks good)
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
CaseyCarter
approved these changes
Aug 26, 2022
strega-nil-ms
approved these changes
Aug 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We're being required to migrate from Azure virtual machine scale sets (VMSS) to One Engineering System (1ES) Hosted Pools. Fortunately, we can preserve the important properties of our current scheme (namely, that we have full control over how we prepare the VM image, capturing a specific VS Preview version). I also figured out how to automate more steps than were previously possible, making the process simpler and more reproducible. Thanks to @BillyONeal for insights here. 💡 😻
For contributors, there should be no significant changes. Runs might take a little longer (we have to change VM SKUs, at least initially), and I'm not sure what kind of sporadic issues we'll see. (Perhaps the sporadic stalls we've been dealing with will be reduced in frequency!) There should be no changes to how the results of PR checks are presented.
I've structured this as a series of commits for easier review. (Because we work on this script so rarely, I also performed several refactorings and cleanups; apologies in advance.)
provision-image.ps1
: PowerShell 7.2.6.create-vmss.ps1
tocreate-1es-hosted-pool.ps1
.Display-Progress-Bar
.$script:CurrentProgress++
, allowing us to modify a variable in the outer script scope (otherwise, a function can only read it).$TotalProgress
should be the number of calls toDisplay-Progress-Bar -Status
.$CurrentDate
, ensuring that the value won't change during the script.Wait-Shutdown
with the-notin
operator.Find-ResourceGroupName
; 'HHmm' provides sufficient uniqueness.$LiveVMPrefix
was only needed forSet-AzVmssOsProfile
.az
) was only needed for VMSS diagnostic logs.New-AzImageConfig
andNew-AzImage
with an Azure Compute Gallery.'eastus'
,'Standard_D32ds_v5'
..gitignore
: Dropvmss-config.json
,vmss-protected.json
.'CPP_STL_GitHub'
and'latest'
.THHmm
time part.)Display-ProgressBar
Param
spacing.Brief explanation of how the 1ES Hosted Pool machinery works (this is my understanding, I hope it's accurate):
An "Azure Compute Gallery" (previously named "Shared Image Gallery"; knowing this is helpful to understand documentation) is a container (in the STL sense) of image definitions, and those are containers of image versions, which are VM snapshots. This happens on the Azure side. Then there are 1ES Images (which refer to those snapshots), and finally 1ES Hosted Pools, which are the new analogues of our old Virtual Machine Scale Sets (the difference is that 1ES is now responsible for obtaining quota, spinning up VMs, etc.). Lots and lots of complexity is possible here, but for the moment, we are using everything in a 1:1 ratio. That is, we create one resource group with one compute gallery, one image definition, one image version, one 1ES image, and one 1ES hosted pool. The pool directly connects to Azure Pipelines (via magic that I can't quite believe worked on the first try). We don't need to worry about images being updated without the pool changing, because we have only one version.
(In the future, we may want/need to explore other schemes, if we run into quota difficulties or whatever, but this will be a starting point.)
The script takes care of several things that would otherwise need to be done through the web UI (granting permission to 1ES Resource Management, creating the 1ES Image and Hosted Pool). I verified through JSON inspection that the scripted results are comparable to the web UI results in the ways that matter (some empty fields were simply omitted, which didn't seem to affect the checks passing).
I've updated the Checklist for Toolset Updates wiki page to explain the new world order. It is generally simpler (no Azure CLI, no web UI for creating a VMSS pool), with the one new part being a manual permission step that involves clicking buttons but not making choices.