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

[Compute] az image builder: Add subgroups and parameters to manage trigger, output versioning options #26261

Merged
merged 10 commits into from
May 17, 2023

Conversation

yanzhudd
Copy link
Contributor

@yanzhudd yanzhudd commented Apr 26, 2023

Related command

az image builder trigger create/show/list/delete

az image builder output add --versioning (latest,source)
az image builder output add --is-vhd --vhd-uri <string>

Description

In az image builder group:

  • add subgroup trigger to manage image builder template trigger.
  • add subgroup output versioning to manage image builder template output versioner.
  • add parameter --versioning for az image builder output add command to describe how to generate new x.y.z version number for distribution.
  • add parameter --vhd-uri for az image builder output add command to specify storage uri for the distributed VHD blob.

Close: #25853

Testing Guide

History Notes

[Compute] az image builder trigger: Add subgroup to manage image builder template trigger
[Compute] az image builder output versioning: Add subgroup to manage image builder template output versioning
[Compute] az image builder output add: Add parameter --versioning to support describing how to generate new x.y.z version number for distribution
[Compute] az image builder output add: Add parameter --vhd-uri to support specifying storage uri for the distributed VHD blob


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Apr 26, 2023

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.10
️✔️3.9
️✔️ams
️✔️latest
️✔️3.10
️✔️3.9
️✔️apim
️✔️latest
️✔️3.10
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.10
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️aro
️✔️latest
️✔️3.10
️✔️3.9
️✔️backup
️✔️latest
️✔️3.10
️✔️3.9
️✔️batch
️✔️latest
️✔️3.10
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.10
️✔️3.9
️✔️billing
️✔️latest
️✔️3.10
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.10
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.10
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️config
️✔️latest
️✔️3.10
️✔️3.9
️✔️configure
️✔️latest
️✔️3.10
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.10
️✔️3.9
️✔️container
️✔️latest
️✔️3.10
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.10
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️dla
️✔️latest
️✔️3.10
️✔️3.9
️✔️dls
️✔️latest
️✔️3.10
️✔️3.9
️✔️dms
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.10
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.10
️✔️3.9
️✔️find
️✔️latest
️✔️3.10
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.10
️✔️3.9
️✔️identity
️✔️latest
️✔️3.10
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.10
️✔️3.9
️✔️lab
️✔️latest
️✔️3.10
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️maps
️✔️latest
️✔️3.10
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.10
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.10
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.10
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.10
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.10
️✔️3.9
️✔️profile
️✔️latest
️✔️3.10
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.10
️✔️3.9
️✔️redis
️✔️latest
️✔️3.10
️✔️3.9
️✔️relay
️✔️latest
️✔️3.10
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️role
️✔️latest
️✔️3.10
️✔️3.9
️✔️search
️✔️latest
️✔️3.10
️✔️3.9
️✔️security
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.10
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.10
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.10
️✔️3.9
️✔️sql
️✔️latest
️✔️3.10
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.10
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.10
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️util
️✔️latest
️✔️3.10
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9

@yanzhudd yanzhudd self-assigned this Apr 26, 2023
@ghost ghost requested review from yonzhan and zhoxing-ms April 26, 2023 05:48
@ghost ghost added the Auto-Assign Auto assign by bot label Apr 26, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 26, 2023

Compute

@ghost ghost requested a review from wangzelin007 April 26, 2023 05:48
@ghost ghost assigned zhoxing-ms Apr 26, 2023
@ghost ghost added the Compute az vm/vmss/image/disk/snapshot label Apr 26, 2023
@yanzhudd yanzhudd assigned yanzhudd and unassigned zhoxing-ms and yanzhudd Apr 26, 2023
@yanzhudd yanzhudd changed the title [Compute] az image builder: Add subgroups to manage optimizer [Compute] az image builder: Add subgroups to manage optimizer, output versioning options Apr 28, 2023
@yanzhudd yanzhudd marked this pull request as ready for review May 12, 2023 08:27
@yanzhudd yanzhudd requested a review from jsntcy as a code owner May 12, 2023 08:27
@yanzhudd yanzhudd changed the title [Compute] az image builder: Add subgroups to manage optimizer, output versioning options [Compute] az image builder: Add subgroups and parameters to manage trigger, optimizer, output versioning options May 12, 2023
@@ -360,6 +368,16 @@ def load_arguments(self, _):
with self.argument_context('image builder validator add', min_api='2022-02-14') as c:
c.argument('dis_on_failure', options_list=['--continue-distribute-on-failure', '--dis-on-failure'], arg_type=get_three_state_flag(), help="If validation fails and this parameter is set to false, output image(s) will not be distributed.")
c.argument('source_validation_only', arg_type=get_three_state_flag(), help="If this parameter is set to true, the image specified in the 'source' section will directly be validated. No separate build will be run to generate and then validate a customized image.")

with self.argument_context('image builder optimizer add', min_api='2022-07-01') as c:
c.argument('optimizer_type', get_enum_type(['vmBoot']), options_list=['--type', '--optimizer-type'], help='The type of optimizer added.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this enumeration only has one value? Will there be more types of --optimizer-type in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently there is only one type of --optimizer-type.
#25853 (comment)

Copy link
Contributor

@zhoxing-ms zhoxing-ms May 15, 2023

Choose a reason for hiding this comment

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

In fact, in the Swagger, the vmBoot property is bool type, I personally think that our parameter design should be consistent with Swagger. code link
And if a parameter can only support passing in one value, making it a Boolean type would be more concise.

Copy link
Contributor

@zhoxing-ms zhoxing-ms May 15, 2023

Choose a reason for hiding this comment

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

@zdelacerda-microsoft May I ask what is the reason for designing vmBoot as a --type {vmBoot} --state {enabled:disabled} parameters? Will the --type parameter expand to more values in the future? Why not use a more concise and clear name, such as --enable-vm-boot?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zdelacerda-microsoft I have a question to confirm. If --type expands to other values in the future, can these values be used simultaneously or can only one of them be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prefetch (3 new commands, also a new "optimize" sub category similar to customizer functionality)

  1. az image builder optimizer add --optimizer-name --type {vmBoot} --state {enabled:disabled} add optimizer to an image template
  2. az image builder optimizer clear removes all optimizers
  3. az image builder optimizer remove --optimizer-name removes an optimizer

@zdelacerda-microsoft
since the usual practice in CLI is using update command to change the status of a resource property and remove command to remove the entile resource, it is suggested to change the format of this group to the following format.
Could you please help to check if it could meet your expectation?

  1. az image builder optimizer add --resource-group-name MyResourceGroup --image-template-name MyTemplate --enable-vm-boot {true:false} add optimizer to an image template
  2. az image builder optimizer update --resource-group-name MyResourceGroup --image-template-name MyTemplate --enable-vm-boot {true:false} update optimizer of an image template
  3. az image builder optimizer remove --resource-group-name MyResourceGroup --image-template-name MyTemplate remove optimizers from an image template

BTW, this format has not been determined yet and there is a code freeze this Friday, the change of this group has to be postponed to next sprint (7-4), --validator parameter in az image builder create as well (#25853 (comment)).
The rest part of this feature request could be released in this sprint.

Copy link

@sichoud sichoud May 17, 2023

Choose a reason for hiding this comment

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

@yanzhudd, examples you mentioned are fine, we want to go with --enable-vm-boot, but state you mentioned is boolean, can it be {enabled:disabled} or {true:false} will will mapped to it? any way will be fine.
Also the update and remove cmd you mentioned will work.

Copy link

Choose a reason for hiding this comment

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

@zhoxing-ms, --type may not be expand in future, but if so it will be used simultaneously not one at a time

Choose a reason for hiding this comment

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

This looks good to me. Thank you @yanzhudd and @zhoxing-ms


helps['image builder optimizer remove'] = """
type: command
short-summary: Remove optimizer from an existing image builder template.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
short-summary: Remove optimizer from an existing image builder template.
short-summary: Remove an optimizer from an existing image builder template.

Comment on lines 504 to 507
short-summary: Remove all optimizers from an existing image builder template.
long-summary: Must be used with --defer
examples:
- name: Remove all optimizers from an existing image builder template.
Copy link
Contributor

@zhoxing-ms zhoxing-ms May 12, 2023

Choose a reason for hiding this comment

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

Suggested change
short-summary: Remove all optimizers from an existing image builder template.
long-summary: Must be used with --defer
examples:
- name: Remove all optimizers from an existing image builder template.
short-summary: Clear all optimizers from an existing image builder template.
long-summary: Must be used with --defer
examples:
- name: Clear all optimizers from an existing image builder template.

Just a small suggestion. The help message of clear should be distinguished from remove, so as to avoid confusion for customers

@yanzhudd yanzhudd changed the title [Compute] az image builder: Add subgroups and parameters to manage trigger, optimizer, output versioning options [Compute] az image builder: Add subgroups and parameters to manage trigger, output versioning options May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Image Builder extension request - API 2022-07-01
5 participants