Skip to content
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

[Breaking Change] Default New-AzGalleryImageDefinition to HyperV Gen2 and Trusted Launch #24869

Merged
merged 15 commits into from May 14, 2024

Conversation

grizzlytheodore
Copy link
Contributor

@grizzlytheodore grizzlytheodore commented May 9, 2024

Description

CLI request equivalent: Azure/azure-cli#28557
New-AzGalleryImageDefinition will default to -HyperVGeneration V2 and -Feature @{name='SecurityType', value='TrustedLaunchSupport'} unless the parameters are provided explicitly

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • For SDK-based development mode, update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • For autorest-based development mode, include the changelog in the PR description.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copy link

azure-client-tools-bot-prd bot commented May 9, 2024

️✔️Az.Accounts
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Compute
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Breaking Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Signature Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help Example Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️File Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️ - Linux
️✔️ - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.KeyVault
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.ManagedServiceIdentity
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Monitor
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Network
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️ - Linux
️✔️ - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.OperationalInsights
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.PrivateDns
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
⚠️Az.RecoveryServices
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
⚠️Test
⚠️ - Linux
Type Title Current Coverage Last Coverage Description
⚠️ Test Coverage Less Than 80% 62.50 % 66.67% Test coverage cannot be lower than the number of the last release.
⚠️ - MacOS
Type Title Current Coverage Last Coverage Description
⚠️ Test Coverage Less Than 80% 62.50% 66.67% Test coverage cannot be lower than the number of the last release.
⚠️PowerShell Core - Windows
Type Title Current Coverage Last Coverage Description
⚠️ Test Coverage Less Than 80% 62.50% 66.67% Test coverage cannot be lower than the number of the last release.
⚠️Windows PowerShell - Windows
Type Title Current Coverage Last Coverage Description
⚠️ Test Coverage Less Than 80% 62.50% 66.67% Test coverage cannot be lower than the number of the last release.
️✔️Az.Security
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️ - Linux
️✔️ - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Sql
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Ssh
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️ - Linux
️✔️ - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Storage
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows

@grizzlytheodore grizzlytheodore changed the title Default New-AzGalleryImageDefinition to HyperV Gen2 and Trusted Launch [Breaking Change] Default New-AzGalleryImageDefinition to HyperV Gen2 and Trusted Launch May 9, 2024
@@ -185,7 +188,19 @@ public override void ExecuteCmdlet()

if (this.IsParameterBound(c => c.Feature))
{
galleryImage.Features = this.Feature;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing from direct assign, to make it easier to add another feature when needed below.

Direct assigned made it immutable list

@YanaXu YanaXu added the Compute label May 10, 2024
@YanaXu YanaXu added the Breaking Change Release This PR contains breaking change label May 10, 2024
Copy link

github-actions bot commented May 10, 2024

To the author of the pull request,
This PR was labeled "Breaking Change Release" because it contains breaking changes.

  • According to our policy, breaking changes can only take place during major release and they must be preannounced.
  • Please follow our guide on the detailed steps.
  • Required: Please fill in the task below to facilitate our contact,you will receive notifications related to breaking changes.

@YanaXu
Copy link
Contributor

YanaXu commented May 10, 2024

Hi @grizzlytheodore , please resove the conflicted file: src/Compute/Compute/ChangeLog.md

@grizzlytheodore
Copy link
Contributor Author

@YanaXu done !

Copy link
Member

@haagha haagha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make the if check in one line.
Also the filename should be renamed to GalleryImageDefinitionCreateOrUpdate.cs

galleryImage.Features.Add(this.Feature[i]);
}
}
if (SecurityTypeNotFoundInFeatures(galleryImage.Features) && galleryImage.HyperVGeneration == "V2")// if SecurityType is not in Features, default to TrustedLaunch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Can you collapse the separate function into 1 single line check?

if (galleryImage.Features?.All(f => f.Name.ToLower() != "securitytype") == true && galleryImage.HyperVGeneration == "V2")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the cool notation. Yes, one line code is better than a function.

I had to add one more conditional for when Feature is not passed in at all, but this notation works well

haagha
haagha previously approved these changes May 10, 2024
@grizzlytheodore
Copy link
Contributor Author

You can make the if check in one line. Also the filename should be renamed to GalleryImageDefinitionCreateOrUpdate.cs

I will refrain from changing filename at this point. I don't want to create more complexity this late before code merge deadline

@YanaXu
Copy link
Contributor

YanaXu commented May 11, 2024

Hi @grizzlytheodore, please remember to fix the CI build error from this file "src\Compute\Compute\Generated\GalleryImage\GalleryImageCreateOrUpdateMethod.cs".

@YanaXu
Copy link
Contributor

YanaXu commented May 13, 2024

Hi @grizzlytheodore & @Sandido & @haagha , I've fixed the CI error. Could you please review it ASAP? The code freeze date is today. Thanks!

@grizzlytheodore
Copy link
Contributor Author

grizzlytheodore commented May 13, 2024

image
image

Providing "None" SecurityType creates the resource in standard securityType

Sandido
Sandido previously approved these changes May 13, 2024
@grizzlytheodore
Copy link
Contributor Author

@YanaXu Adam @Sandido approved it above, but I just needed to change the @ sign to $ in variables in an example I added in the last commit

@YanaXu YanaXu merged commit 1425b11 into main May 14, 2024
12 checks passed
@YanaXu YanaXu deleted the feature/cplat-GalleryBreakingChange branch May 14, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change Release This PR contains breaking change Compute
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants