-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: enhanced target create with onboarding simplification flags #9780
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
Open
atharvau
wants to merge
29
commits into
Azure:main
Choose a base branch
from
manaswita-chichili:audapure/cli-simplification-target-create
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
139d152
feat: enhanced target create with onboarding simplification flags
5d9fb5a
refactor: extract onboarding handlers into focused modules
5374406
fix: resolve context_id before init-hierarchy and fix sub_id lookup
cc808d4
refactor: remove standalone 'target prepare' command
be0e419
refactor: remove standalone 'hierarchy create' command
9b5c319
fix: address PR review comments from Copilot
bc354b4
refactor: align with team feedback - separate target init, remove ini…
a927395
feat: add target deploy command (review → publish → install)
3bb524c
feat: enhance target deploy with friendly name, resume-from, config-set
d88dc65
fix: extract solutionVersionId from properties.id in LRO response
3ca0b77
fix: add --solution flag to config-set and improve logging
066689c
refactor: remove skip flags, fix linter errors, add short aliases
e5e330c
cleanup: remove duplicate output from target init
84a10dc
cleanup: remove preview tags from target and support command groups
d81f4bc
fix: step counter display in target deploy
230ea5c
fix: return install LRO result matching native target install format
fa2bc60
cleanup: remove diagnostic summary from target init success output
51e988e
feat: context create accepts --site-id to auto-create site reference
45ad448
refactor: remove --resume-from and --solution-version-id from target …
bca3b13
feat: merge deploy into target install, remove standalone deploy command
c5e06bb
refactor: remove config-template args, auto-derive from solution temp…
ba7bd26
refactor: rename 'target init' to 'cluster init'
d98e2aa
refactor: remove default target-specification auto-injection
7250fe9
refactor: remove --solution-template-rg per Shubham's feedback
24992eb
cleanup: remove short aliases, use full option names only
7927663
fix: remove leftover solution_template_rg reference in config path
e600c9a
refactor: remove skip, kube, and reinstall options from cluster init
4642f2d
feat: add hierarchy create command (ResourceGroup + ServiceGroup)
e735464
feat: hierarchy create with SG support, RBAC propagation, RG-scoped c…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| # flake8: noqa | ||
|
|
||
| from azure.cli.core.aaz import * | ||
| from azure.cli.core.azclierror import CLIInternalError as CLIError | ||
|
|
||
|
|
||
| @register_command( | ||
|
|
@@ -128,6 +129,14 @@ def _build_arguments_schema(cls, *args, **kwargs): | |
|
|
||
| tags = cls._args_schema.tags | ||
| tags.Element = AAZStrArg() | ||
|
|
||
| # Custom arg: --site-id (not sent to ARM, used in post_operations) | ||
| _args_schema.site_id = AAZStrArg( | ||
| options=["--site-id"], | ||
| arg_group="Onboarding", | ||
| help="ARM resource ID of a Site to auto-create a site reference after context creation.", | ||
| ) | ||
|
|
||
| return cls._args_schema | ||
|
|
||
| def _execute_operations(self): | ||
|
|
@@ -141,7 +150,47 @@ def pre_operations(self): | |
|
|
||
| @register_callback | ||
| def post_operations(self): | ||
| pass | ||
| if hasattr(self.ctx.args, 'site_id') and self.ctx.args.site_id: | ||
| self._create_site_reference() | ||
|
|
||
| def _create_site_reference(self): | ||
| """Auto-create a site reference linking the site to this context.""" | ||
| import logging | ||
| import re | ||
| logger = logging.getLogger(__name__) | ||
|
|
||
| site_id = str(self.ctx.args.site_id) | ||
| context_name = str(self.ctx.args.context_name) | ||
| rg = str(self.ctx.args.resource_group) | ||
|
|
||
| # Extract site name from ARM ID for the reference name | ||
| site_name = site_id.rstrip("/").split("/")[-1] | ||
| ref_name = f"{site_name}-ref" | ||
| # Sanitize: only alphanumeric and hyphens, 3-61 chars | ||
| ref_name = re.sub(r'[^a-zA-Z0-9-]', '-', ref_name)[:61] | ||
|
|
||
| logger.info("Creating site reference '%s' -> %s", ref_name, site_id) | ||
|
|
||
| try: | ||
| from azext_workload_orchestration.onboarding.utils import invoke_cli_command, CmdProxy | ||
| cmd_proxy = CmdProxy(self.ctx.cli_ctx) | ||
| invoke_cli_command(cmd_proxy, [ | ||
| "workload-orchestration", "context", "site-reference", "create", | ||
| "-g", rg, | ||
| "--context-name", context_name, | ||
| "--site-reference-name", ref_name, | ||
| "--site-id", site_id, | ||
| ]) | ||
| logger.info("Site reference '%s' created successfully", ref_name) | ||
| except Exception as exc: | ||
| logger.warning("Site reference creation failed: %s", exc) | ||
| raise CLIError( | ||
| f"Context created successfully, but site reference creation failed: {exc}\n" | ||
| f"Run manually:\n" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this |
||
| f" az workload-orchestration context site-reference create " | ||
| f"-g {rg} --context-name {context_name} " | ||
| f"--site-reference-name {ref_name} --site-id {site_id}" | ||
| ) | ||
|
|
||
| def _output(self, *args, **kwargs): | ||
| result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Is this optionalk should itg be optional if passewd create site reference