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

[ARM] az deployment sub/group what-if:Add new commands to support What-If for ARM template deployment #12942

Merged
merged 34 commits into from
Apr 27, 2020

Conversation

shenglol
Copy link
Contributor

@shenglol shenglol commented Apr 10, 2020

Description of PR (Mandatory)
The PR adds new commands for ARM template deployment What-If (in preview):

  • az deployment sub what-if
  • az deployment group what-if

which can tell users what will happen when they deploy a template if it is valid.

A new flag --confirm-with-what-if was also added to the existing deployment sub/group create commands to allow users to review and acknowledge resource changes and execute deployment with one operation.

Here's a sample output:
image

Testing Guide
(Example commands with explanations)

History Notes:
(Fill in the following template if multiple notes are needed, otherwise PR title will be used for history note.)

[ARM] Add template deployment What-If commands


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

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 10, 2020

add to S168

@zhoxing-ms
Copy link
Contributor

@shenglol Why doesn't az deployment mg, az deployment tenant have what-if?

@zhoxing-ms
Copy link
Contributor

I suggest that it might be better to change the PR title, like: [ARM] az deployment sub/group/... what-if:Add new commands to support What-If for ARM template deployment
PR title writing guide: link

@shenglol shenglol changed the title [ARM] Add template deployment What-If commands [ARM] az deployment sub/group what-if:Add new commands to support What-If for ARM template deployment Apr 10, 2020
@shenglol
Copy link
Contributor Author

shenglol commented Apr 10, 2020

@shenglol Why doesn't az deployment mg, az deployment tenant have what-if?

Currently the What-If back-end doesn't support mg-level and tenant-level deployments. We might add the support in the future.

@shenglol
Copy link
Contributor Author

I suggest that it might be better to change the PR title, like: [ARM] az deployment sub/group/... what-if:Add new commands to support What-If for ARM template deployment
PR title writing guide: link

Thanks. I changed the title.

@shenglol
Copy link
Contributor Author

shenglol commented Apr 17, 2020

@zhoxing-ms @jiasli do you mind helping merge it once the build pipeline passes? It would be great if we can still catch the next release.

@jiasli
Copy link
Member

jiasli commented Apr 17, 2020

@zhoxing-ms @jiasli do you mind helping merge it once the build pipe line passes? It would be great if we can still catch the next release.

Absolutely!

@yonzhan yonzhan modified the milestones: S168, S169 - For Build Apr 17, 2020
@shenglol shenglol requested a review from Juliehzl April 17, 2020 16:59
@shenglol
Copy link
Contributor Author

@Juliehzl could you take another look at the PR when you get a chance? Thanks!

@Juliehzl
Copy link
Contributor

@Juliehzl could you take another look at the PR when you get a chance? Thanks!

LGTM in general but curious about the fantastic function you add. 😊


import unittest

from azure.mgmt.resource.resources.models import (
Copy link
Contributor

@Juliehzl Juliehzl Apr 24, 2020

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@shenglol shenglol Apr 24, 2020

Choose a reason for hiding this comment

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

Replaced import with get_model(). Regarding using mock(), I don't think it's needed in the formatters unit tests (since there's no dependencies to assert/verify), but I added two tests with mocks to verify prompt logic with -confirm-with-what-if, which seems to be worth testing to me: https://github.com/Azure/azure-cli/pull/12942/files#diff-a94496ee0aa9c24d38ce3e3e2793c8a2R337-R358.

@shenglol shenglol requested a review from Juliehzl April 24, 2020 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants