-
Notifications
You must be signed in to change notification settings - Fork 1.5k
containerapp - Add --source and --repo to containerapp create #6463
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
Changes from all commits
887ecf6
011439a
e9fd59b
89241ca
916259c
1439120
fb7f4fe
d18d6c7
78181aa
d646bd1
56e68d4
1b70cf5
3a809ca
07e1be5
25862fb
0b2098b
3fd9fde
557f05e
c2fb2d6
ef8c6df
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 |
|---|---|---|
|
|
@@ -60,7 +60,6 @@ | |
| LOG_ANALYTICS_RP, | ||
| CONTAINER_APPS_RP, | ||
| ACR_IMAGE_SUFFIX, | ||
| MAXIMUM_CONTAINER_APP_NAME_LENGTH, | ||
|
Member
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. nit: intended change?
Contributor
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. Yep, |
||
| ACR_TASK_TEMPLATE, | ||
| DEFAULT_PORT) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,21 +6,33 @@ | |
|
|
||
| import re | ||
| from azure.cli.core.azclierror import (ValidationError, ResourceNotFoundError, InvalidArgumentValueError, | ||
| MutuallyExclusiveArgumentError) | ||
| MutuallyExclusiveArgumentError, RequiredArgumentMissingError) | ||
| from msrestazure.tools import is_valid_resource_id | ||
| from knack.log import get_logger | ||
|
|
||
| from ._clients import ContainerAppClient | ||
| from ._ssh_utils import ping_container_app | ||
| from ._utils import safe_get, is_registry_msi_system | ||
| from ._constants import ACR_IMAGE_SUFFIX, LOG_TYPE_SYSTEM | ||
| from ._constants import ACR_IMAGE_SUFFIX, LOG_TYPE_SYSTEM, MAXIMUM_SECRET_LENGTH | ||
| from urllib.parse import urlparse | ||
|
|
||
|
|
||
| logger = get_logger(__name__) | ||
|
|
||
|
|
||
| # called directly from custom method bc otherwise it disrupts the --environment auto RID functionality | ||
| def validate_create(registry_identity, registry_pass, registry_user, registry_server, no_wait): | ||
| def validate_create(registry_identity, registry_pass, registry_user, registry_server, no_wait, source=None, repo=None): | ||
| if source and repo: | ||
| raise MutuallyExclusiveArgumentError("Cannot use --source and --repo together. Can either deploy from a local directory or a GitHub repository") | ||
| if source or repo: | ||
| if not registry_server or not registry_user or not registry_pass: | ||
| raise RequiredArgumentMissingError('Usage error: --registry-server, --registry-username and --registry-password are required while using --source or --repo.') | ||
| if repo and registry_server and "azurecr.io" in registry_server: | ||
| parsed = urlparse(registry_server) | ||
|
Contributor
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. @cormacpayne we should check this condition for source also?
Member
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. @snehapar9 we should since we have the condition above to validate that if source or repo:
if not registry_server or not registry_user or not registry_pass:
raise RequiredArgumentMissingError('Usage error: --registry-server, --registry-username and --registry-password are required while using --source or --repo.')
if "azurecr.io" in registry_server:
parsed = urlparse(registry_server)
registry_name = (parsed.netloc if parsed.scheme else parsed.path).split(".")[0]
if registry_name and len(registry_name) > MAXIMUM_SECRET_LENGTH:
raise ValidationError(f"--registry-server ACR name must be less than {MAXIMUM_SECRET_LENGTH} "
"characters when using --repo")``` |
||
| registry_name = (parsed.netloc if parsed.scheme else parsed.path).split(".")[0] | ||
| if registry_name and len(registry_name) > MAXIMUM_SECRET_LENGTH: | ||
| raise ValidationError(f"--registry-server ACR name must be less than {MAXIMUM_SECRET_LENGTH} " | ||
| "characters when using --repo") | ||
| if registry_identity and (registry_pass or registry_user): | ||
| raise MutuallyExclusiveArgumentError("Cannot provide both registry identity and username/password") | ||
| if is_registry_msi_system(registry_identity) and no_wait: | ||
|
|
||
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 the argument is in preview, add
is_preview=TrueThere 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.
These flags are not in preview.