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

Containerapp Version 0.3.7 #4960

Merged
merged 9 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Release History
===============

0.3.7
++++++
* Fixed bug with 'az containerapp up' where --registry-server was ignored
* 'az containerapp env create': fixed bug where "--internal-only" didn't work
* 'az containerapp registry set': remove username/password if setting identity and vice versa

0.3.6
++++++
* BREAKING CHANGE: 'az containerapp revision list' now shows only active revisions by default, added flag --all to show all revisions
Expand Down
27 changes: 11 additions & 16 deletions src/containerapp/azext_containerapp/_up_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,24 +592,19 @@ def _get_acr_from_image(cmd, app):
)


def _get_registry_from_app(app):
def _get_registry_from_app(app, source):
containerapp_def = app.get()
existing_registries = safe_get(containerapp_def, "properties", "configuration", "registries", default=[])
if source:
existing_registries = [r for r in existing_registries if ACR_IMAGE_SUFFIX in r["server"]]
if containerapp_def:
if (
len(
safe_get(
containerapp_def,
"properties",
"configuration",
"registries",
default=[],
)
)
== 1
):
app.registry_server = containerapp_def["properties"]["configuration"][
"registries"
][0]["server"]
if len(existing_registries) == 1:
app.registry_server = existing_registries[0]["server"]
elif len(existing_registries) > 1: # default to registry in image if possible, otherwise don't infer
containers = safe_get(containerapp_def, "properties", "template", "containers", default=[])
image_server = next(c["image"] for c in containers if c["name"].lower() == app.name.lower()).split('/')[0]
if image_server in [r["server"] for r in existing_registries]:
app.registry_server = image_server


def _get_acr_rg(app):
Expand Down
10 changes: 7 additions & 3 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ def create_managed_environment(cmd,

managed_env_def = ManagedEnvironmentModel
managed_env_def["location"] = location
managed_env_def["properties"]["internalLoadBalancerEnabled"] = False
managed_env_def["properties"]["appLogsConfiguration"] = app_logs_config_def
managed_env_def["tags"] = tags
managed_env_def["properties"]["zoneRedundant"] = zone_redundant
Expand Down Expand Up @@ -835,7 +834,7 @@ def create_managed_environment(cmd,
if internal_only:
if not infrastructure_subnet_resource_id:
raise ValidationError('Infrastructure subnet resource ID needs to be supplied for internal only environments.')
managed_env_def["properties"]["internalLoadBalancerEnabled"] = True
managed_env_def["properties"]["vnetConfiguration"]["internal"] = True

try:
r = ManagedEnvironmentClient.create(
Expand Down Expand Up @@ -1730,15 +1729,19 @@ def set_registry(cmd, name, resource_group_name, server, username=None, password
updating_existing_registry = True
if username:
r["username"] = username
r["identity"] = None
if password:
r["passwordSecretRef"] = store_as_secret_and_return_secret_ref(
containerapp_def["properties"]["configuration"]["secrets"],
r["username"],
r["server"],
password,
update_existing_secret=True)
r["identity"] = None
if identity:
r["identity"] = identity
r["username"] = None
r["passwordSecretRef"] = None

# If not updating existing registry, add as new registry
if not updating_existing_registry:
Expand Down Expand Up @@ -2234,7 +2237,8 @@ def containerapp_up(cmd,
env.create_if_needed(name)

if source or repo:
_get_registry_from_app(app) # if the app exists, get the registry
if not registry_server:
_get_registry_from_app(app, source) # if the app exists, get the registry
_get_registry_details(cmd, app, source) # fetch ACR creds from arguments registry arguments

app.create_acr_if_needed()
Expand Down
2 changes: 1 addition & 1 deletion src/containerapp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.

VERSION = '0.3.6'
VERSION = '0.3.7'


# The full list of classifiers is available at
Expand Down