-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Containerapp 0.3.8 Release #5026
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
bfaaaf1
5f3b965
4995049
9f28b52
35fddc1
e55116f
8cce1f9
284bd3d
53e83b0
d8ceed7
6824d16
bb52fa5
d7af6aa
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 |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ | |
| register_provider_if_needed | ||
| ) | ||
|
|
||
| from ._constants import MAXIMUM_SECRET_LENGTH, LOG_ANALYTICS_RP, CONTAINER_APPS_RP, ACR_IMAGE_SUFFIX | ||
| from ._constants import MAXIMUM_SECRET_LENGTH, LOG_ANALYTICS_RP, CONTAINER_APPS_RP, ACR_IMAGE_SUFFIX, MAXIMUM_CONTAINER_APP_NAME_LENGTH | ||
|
|
||
| from .custom import ( | ||
| create_managed_environment, | ||
|
|
@@ -670,6 +670,18 @@ def _get_registry_details(cmd, app: "ContainerApp", source): | |
| ) | ||
|
|
||
|
|
||
| def _validate_containerapp_name(name): | ||
| is_valid = True | ||
| is_valid = is_valid and name.lower() == name | ||
| is_valid = is_valid and len(name) <= MAXIMUM_CONTAINER_APP_NAME_LENGTH | ||
| is_valid = is_valid and '--' not in name | ||
StrawnSC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name = name.replace('-', '') | ||
| is_valid = is_valid and name.isalnum() | ||
| is_valid = is_valid and name[0].isalpha() | ||
| if not is_valid: | ||
| raise ValidationError(f"Invalid Container App name {name}. A name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, cannot have '--', and must be less than {MAXIMUM_CONTAINER_APP_NAME_LENGTH} characters.") | ||
|
|
||
|
Contributor
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. seems like the message is copied from portal ;) but "alphabetic character" seems incorrect English to me.
Contributor
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. This message is copied from the API |
||
|
|
||
| # attempt to populate defaults for managed env, RG, ACR, etc | ||
| def _set_up_defaults( | ||
| cmd, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=line-too-long, consider-using-f-string, no-else-return, duplicate-string-formatting-argument, expression-not-assigned, too-many-locals, logging-fstring-interpolation | ||
| # pylint: disable=line-too-long, consider-using-f-string, no-else-return, duplicate-string-formatting-argument, expression-not-assigned, too-many-locals, logging-fstring-interpolation, broad-except | ||
|
|
||
| import time | ||
| import json | ||
|
|
@@ -788,6 +788,36 @@ def _remove_readonly_attributes(containerapp_def): | |
| del containerapp_def['properties'][unneeded_property] | ||
|
|
||
|
|
||
| # Remove null/None properties in a model since the PATCH API will delete those. Not needed once we move to the SDK | ||
| def clean_null_values(d): | ||
StrawnSC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if isinstance(d, dict): | ||
| return { | ||
| k: v | ||
| for k, v in ((k, clean_null_values(v)) for k, v in d.items()) | ||
| if v | ||
| } | ||
| if isinstance(d, list): | ||
| return [v for v in map(clean_null_values, d) if v] | ||
| return d | ||
|
|
||
|
|
||
| def _populate_secret_values(containerapp_def, secret_values): | ||
|
Contributor
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. @haroonf , don't need to change this logic for now, since we need to release the fix.
Contributor
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. The deserialization process leaves the json payload to {name: xyz, value: null}. The API returns an error "cannot set secret values to null." |
||
| secrets = safe_get(containerapp_def, "properties", "configuration", "secrets", default=None) | ||
| if not secrets: | ||
| secrets = [] | ||
| if not secret_values: | ||
| secret_values = [] | ||
| index = 0 | ||
| while index < len(secrets): | ||
| value = secrets[index] | ||
| if "value" not in value or not value["value"]: | ||
| try: | ||
| value["value"] = next(s["value"] for s in secret_values if s["name"] == value["name"]) | ||
| except StopIteration: | ||
| pass | ||
| index += 1 | ||
|
|
||
|
|
||
| def _remove_dapr_readonly_attributes(daprcomponent_def): | ||
| unneeded_properties = [ | ||
| "id", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.