-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Changes to helper scripts to support ComputeGallery #13715
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -91,6 +91,13 @@ Function GenerateResourcesAndImage { | |||||||||||||||||
| The type of image to generate. Valid values are: Windows2022, Windows2025, Windows2025_vs2026, Ubuntu2204, Ubuntu2404. | ||||||||||||||||||
| .PARAMETER ManagedImageName | ||||||||||||||||||
| The name of the managed image to create. The default is "Runner-Image-{{ImageType}}". | ||||||||||||||||||
| .PARAMETER ComputeGalleryName | ||||||||||||||||||
| The name of the compute gallery to create. If specified will override the default behavior of creating a managed image. | ||||||||||||||||||
| Will use the ResourceGroupName parameter as the resource group for the compute gallery. | ||||||||||||||||||
| .PARAMETER ComputeGalleryImageName | ||||||||||||||||||
| The name of the compute gallery image to create. This is required if ComputeGalleryName is specified. | ||||||||||||||||||
| .PARAMETER ComputeGalleryImageVersion | ||||||||||||||||||
| The name of the compute gallery image version to create. This is required if ComputeGalleryName is specified. | ||||||||||||||||||
| .PARAMETER AzureLocation | ||||||||||||||||||
| The Azure location where the Azure resources will be created. For example: "East US" | ||||||||||||||||||
| .PARAMETER ImageGenerationRepositoryRoot | ||||||||||||||||||
|
|
@@ -130,6 +137,12 @@ Function GenerateResourcesAndImage { | |||||||||||||||||
| [ImageType] $ImageType, | ||||||||||||||||||
| [Parameter(Mandatory = $False)] | ||||||||||||||||||
| [string] $ManagedImageName = "Runner-Image-$($ImageType)", | ||||||||||||||||||
| [Parameter(Mandatory = $False)] | ||||||||||||||||||
| [string] $ComputeGalleryName, | ||||||||||||||||||
| [Parameter(Mandatory = $False)] | ||||||||||||||||||
| [string] $ComputeGalleryImageName, | ||||||||||||||||||
| [Parameter(Mandatory = $False)] | ||||||||||||||||||
| [string] $ComputeGalleryImageVersion, | ||||||||||||||||||
| [Parameter(Mandatory = $True)] | ||||||||||||||||||
| [string] $AzureLocation, | ||||||||||||||||||
| [Parameter(Mandatory = $False)] | ||||||||||||||||||
|
|
@@ -161,6 +174,17 @@ Function GenerateResourcesAndImage { | |||||||||||||||||
| throw "'packer' binary is not found on PATH." | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| # Validate Compute Gallery parameters | ||||||||||||||||||
| if ($ComputeGalleryName -and -not $ComputeGalleryImageName) { | ||||||||||||||||||
| throw "ComputeGalleryImageName parameter is required when ComputeGalleryName is specified." | ||||||||||||||||||
| } | ||||||||||||||||||
| if ($ComputeGalleryName -and -not $ComputeGalleryImageVersion) { | ||||||||||||||||||
| throw "ComputeGalleryImageVersion parameter is required when ComputeGalleryName is specified." | ||||||||||||||||||
| } | ||||||||||||||||||
| if ($ComputeGalleryImageVersion -and -not ($ComputeGalleryImageVersion -match '^\d+\.\d+\.\d+$')) { | ||||||||||||||||||
|
||||||||||||||||||
| if ($ComputeGalleryImageVersion -and -not ($ComputeGalleryImageVersion -match '^\d+\.\d+\.\d+$')) { | |
| if ($ComputeGalleryImageName -and -not $ComputeGalleryName) { | |
| throw "ComputeGalleryName parameter is required when ComputeGalleryImageName is specified." | |
| } | |
| if ($ComputeGalleryImageVersion -and -not $ComputeGalleryName) { | |
| throw "ComputeGalleryName parameter is required when ComputeGalleryImageVersion is specified." | |
| } | |
| if ($ComputeGalleryName -and $ComputeGalleryImageVersion -and -not ($ComputeGalleryImageVersion -match '^\d+\.\d+\.\d+$')) { |
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.
If wanting to do complete validation rather than silently ignore, we could do a more comprehensive check of all scenarios using an array of the 3 inputs, select non-empty and then length -eq 0 or length -eq 3.
Not sure if this is worthwhile as it looks pretty messy, but may give extra validation for people mis-inputting the parameters.
Uh oh!
There was an error while loading. Please reload this page.