Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
3 changes: 2 additions & 1 deletion scripts/ci/credscan/CredScanSuppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"src\\containerapp\\azext_containerapp\\tests\\latest\\recordings\\test_containerapp_revision_label_e2e.yaml",
"src\\containerapp\\azext_containerapp\\tests\\latest\\cert.pfx",
"src\\containerapp\\azext_containerapp\\tests\\latest\\test_containerapp_commands.py",
"src\\containerapp\\azext_containerapp\\tests\\latest\\test_containerapp_env_commands.py"
"src\\containerapp\\azext_containerapp\\tests\\latest\\test_containerapp_env_commands.py",
"src\\containerapp\\azext_containerapp\\tests\\latest\\recordings\\test_containerapp_registry_msi.yaml"
],
"_justification": "Dummy resources' keys left during testing Microsoft.App (required for log-analytics to create managedEnvironments)"
},
Expand Down
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
2 changes: 2 additions & 0 deletions src/containerapp/azext_containerapp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,8 @@ def _registry_exists(containerapp_def, registry_server):
# get a value from nested dict without getting IndexError (returns None instead)
# for example, model["key1"]["key2"]["key3"] would become safe_get(model, "key1", "key2", "key3")
def safe_get(model, *keys, default=None):
if not model:
return default
for k in keys[:-1]:
model = model.get(k, {})
return model.get(keys[-1], default)
Expand Down
242 changes: 101 additions & 141 deletions src/containerapp/azext_containerapp/custom.py

Large diffs are not rendered by default.

Loading