Skip to content

Commit f6dda56

Browse files
Containerapp-compose Release 0.2.1 (#5262)
1 parent 52725ab commit f6dda56

11 files changed

+7924
-32
lines changed

scripts/ci/credscan/CredScanSuppressions.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -150,26 +150,29 @@
150150
{
151151
"file": [
152152
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_basic_no_existing_resources.yaml",
153-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_both_cpus_and_deploy_cpu.yaml",
154-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_environment.yaml",
155-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_deploy_cpu.yaml",
156-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_environment_prompt.yaml",
157-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_service_cpus.yaml",
158-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_both.yaml",
159-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_secrets.yaml",
160-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_external.yaml",
161-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_secrets_and_existing_environment.yaml",
162-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_internal.yaml",
163-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_secrets_and_existing_environment_conflict.yaml",
164-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_prompt.yaml",
165-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_transport_arg.yaml",
166-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_registry_all_args.yaml",
167-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_with_command_list.yaml",
168-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_registry_server_arg_only.yaml",
169-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_with_command_list_and_entrypoint.yaml",
170-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_replicas_global_scale.yaml",
171-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_with_command_string.yaml",
172-
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_replicas_replicated_mode.yaml"
153+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_location_differ_from_resource_group.yaml",
154+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_environment.yaml",
155+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_environment_prompt.yaml",
156+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_both.yaml",
157+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_external.yaml",
158+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_internal.yaml",
159+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_ingress_prompt.yaml",
160+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_registry_all_args.yaml",
161+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_registry_server_arg_only.yaml",
162+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_replicas_global_scale.yaml",
163+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_replicas_replicated_mode.yaml",
164+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_both_cpus_and_deploy_cpu.yaml",
165+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_deploy_cpu.yaml",
166+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_deploy_with_mismatched_cpu_memory.yaml",
167+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_service_cpus.yaml",
168+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_resources_from_service_memory.yaml",
169+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_secrets.yaml",
170+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_secrets_and_existing_environment.yaml",
171+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_secrets_and_existing_environment_conflict.yaml",
172+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_create_with_transport_arg.yaml",
173+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_with_command_list.yaml",
174+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_with_command_list_and_entrypoint.yaml",
175+
"src\\containerapp-compose\\azext_containerapp_compose\\tests\\latest\\recordings\\test_containerapp_compose_with_command_string.yaml"
173176
],
174177
"_justification": "Dummy resources' tokens left during testing."
175178
}

src/containerapp-compose/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Release History
44
===============
55

6+
0.2.1
7+
++++++
8+
* Fix bug where location parameter was not being passed to containerapp environment creation
9+
* Make memory/cpu resolution more resilient and improve warning messages
10+
611
0.2.0
712
++++++
813
* Add basic build support for compose services

src/containerapp-compose/azext_containerapp_compose/_monkey_patch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def override_random_log_analytics_name(resource_group_name): # pylint: disable=
5151
def create_containerapps_compose_environment(cmd,
5252
name,
5353
resource_group_name,
54+
location,
5455
logs_workspace_name=None,
5556
tags=None):
5657
if logs_workspace_name is not None:
@@ -60,6 +61,7 @@ def create_containerapps_compose_environment(cmd,
6061
return custom.create_managed_environment(cmd,
6162
name,
6263
resource_group_name,
64+
location=location,
6365
tags=tags)
6466

6567

src/containerapp-compose/azext_containerapp_compose/custom.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
134134
managed_environment = create_containerapps_compose_environment(cmd,
135135
managed_env,
136136
resource_group_name,
137+
location,
137138
logs_workspace_name=logs_workspace_name,
138139
tags=tags)
139140

@@ -317,31 +318,55 @@ def valid_resource_settings():
317318
# https://docs.microsoft.com/azure/container-apps/containers#configuration
318319
return {
319320
"0.25": "0.5",
320-
"0.5": "1.0",
321+
"0.5": "1",
321322
"0.75": "1.5",
322-
"1.0": "2.0",
323+
"1.0": "2",
323324
"1.25": "2.5",
324-
"1.5": "3.0",
325+
"1.5": "3",
325326
"1.75": "3.5",
326-
"2.0": "4.0",
327+
"2.0": "4",
327328
}
328329

329330

330331
def validate_memory_and_cpu_setting(cpu, memory):
331332
settings = valid_resource_settings()
332-
333333
if cpu in settings.keys(): # pylint: disable=C0201
334334
if memory != settings[cpu]:
335335
if memory is not None:
336-
warning = f"Unsupported memory reservation request of {memory}."
337-
warning += f"The default value of {settings[cpu]}Gi will be used."
336+
warning = f"Unsupported memory reservation request of {memory}. "
337+
warning += f"The default value of {settings[cpu]} GB for {cpu} vCPUs will be used. "
338+
warning += "Please see memory and vCPU configuration options for Azure Container Apps at "
339+
warning += "https://docs.microsoft.com/en-us/azure/container-apps/containers#configuration "
338340
logger.warning(warning)
339341
memory = settings[cpu]
340342
return (cpu, f"{memory}Gi")
341343

342-
if cpu is not None:
343-
logger.warning( # pylint: disable=W1203
344-
f"Invalid CPU reservation request of {cpu}. The default resource values will be used.")
344+
if memory in settings.values():
345+
new_cpu = "0.25"
346+
for c, m in settings.items():
347+
if memory == m:
348+
new_cpu = c
349+
if cpu != new_cpu:
350+
if cpu is not None:
351+
warning = f"Unsupported cpu configuration request of {cpu}. "
352+
warning += f"The default value of {new_cpu} vCPUs for {memory} GB will be used. "
353+
warning += "Please see memory and vCPU configuration options for Azure Container Apps at "
354+
warning += "https://docs.microsoft.com/en-us/azure/container-apps/containers#configuration "
355+
logger.warning(warning)
356+
return (new_cpu, f"{memory}Gi")
357+
358+
warning = ""
359+
if cpu is not None and memory is not None:
360+
warning += f"Invalid CPU and memory reservation request of {cpu} vCPU and {memory}. "
361+
elif cpu is not None:
362+
warning += f"Invalid CPU reservation request of {cpu} vCPU. "
363+
elif memory is not None:
364+
warning += f"Invalid memory reservation request of {memory} GB. "
365+
if cpu is not None or memory is not None:
366+
warning += "The default resource values of 0.25 vCPU and 0.5 GB will be used. "
367+
warning += "Please see memory and vCPU configuration options for Azure Container Apps at "
368+
warning += "https://docs.microsoft.com/en-us/azure/container-apps/containers#configuration "
369+
logger.warning(warning)
345370
return (None, None)
346371

347372

src/containerapp-compose/azext_containerapp_compose/tests/latest/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ def clean_up_test_file(filename):
2222

2323
class ContainerappComposePreviewScenarioTest(ScenarioTest):
2424
def setUp(self):
25-
self.cmd("extension add --name containerapp --upgrade --yes")
25+
self.cmd("extension add --name containerapp --upgrade --version 0.3.8 --yes")
2626
return super().setUp()

0 commit comments

Comments
 (0)