Skip to content

Commit 004c93f

Browse files
author
Simon Jakesch
committed
fix: Address PR review feedback
- Fix syntax error: Remove duplicate return statement (line 2218) - Fix grammar: 'are yet supported' -> 'are not yet supported' - Remove commented-out code - Fix dry-run allow_insecure to show actual config value - Fix choice_index undefined variable with proper error handling - Remove duplicate 'import re' statements - Fix gpu_profile undefined variable by reading from raw YAML - Revert version from 1.2.0b6 to 1.2.0b5 (maintainers handle releases) - Remove premium-ingress params that came from upstream rebase Addresses feedback from @Greedygre and Copilot AI review
1 parent 96cec3b commit 004c93f

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

src/containerapp/azext_containerapp/_compose_utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def warn_about_unsupported_build_configuration(compose_service):
104104
"target", "secrets", "tags"]
105105
if compose_service.build is not None:
106106
config_list = resolve_configuration_element_list(compose_service, unsupported_configuration, 'build')
107-
message = "These build configuration settings from the docker-compose file are yet supported."
107+
message = "These build configuration settings from the docker-compose file are not yet supported."
108108
message += " Currently, we support supplying a build context and optionally target Dockerfile for a service."
109109
message += " See https://aka.ms/containerapp/compose/build_support for more information or to add feedback."
110110
if len(config_list) >= 1:
@@ -314,12 +314,15 @@ def resolve_memory_configuration_from_service(service):
314314

315315

316316
def resolve_port_or_expose_list(ports, name):
317-
if len(ports) > 1:
317+
if len(ports) == 1:
318+
return ports[0]
319+
elif len(ports) > 1:
318320
message = f"You have more than one {name} mapping defined in your docker-compose file."
319321
message += " Which port would you like to use? "
320322
choice_index = prompt_choice_list(message, ports)
321-
322-
return ports[choice_index]
323+
return ports[choice_index]
324+
else:
325+
raise ValueError(f"No {name} mappings defined.")
323326

324327

325328
def resolve_ingress_and_target_port(service):

src/containerapp/azext_containerapp/_params.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -521,17 +521,6 @@ def load_arguments(self, _):
521521
c.argument('mode', arg_type=get_enum_type(['single', 'multiple', 'labels']), help="The active revisions mode for the container app.")
522522
c.argument('target_label', help="The label to apply to new revisions. Required for revision mode 'labels'.", is_preview=True)
523523

524-
with self.argument_context('containerapp env premium-ingress') as c:
525-
c.argument('resource_group_name', arg_type=resource_group_name_type, id_part=None)
526-
c.argument('name', options_list=['--name', '-n'], help="The name of the managed environment.")
527-
c.argument('workload_profile_name', options_list=['--workload-profile-name', '-w'], help="The workload profile to run ingress replicas on. This profile must not be shared with any container app or job.")
528-
c.argument('min_replicas', options_list=['--min-replicas'], type=int, deprecate_info=c.deprecate(hide=True, expiration='2.79.0'), help="The workload profile minimum instances is used instead.")
529-
c.argument('max_replicas', options_list=['--max-replicas'], type=int, deprecate_info=c.deprecate(hide=True, expiration='2.79.0'), help="The workload profile maximum instances is used instead.")
530-
c.argument('termination_grace_period', options_list=['--termination-grace-period', '-t'], type=int, help="Time in seconds to drain requests during ingress shutdown. Default 500, minimum 0, maximum 3600.")
531-
c.argument('request_idle_timeout', options_list=['--request-idle-timeout'], type=int, help="Timeout in minutes for idle requests. Default 4, minimum 4, maximum 30.")
532-
c.argument('header_count_limit', options_list=['--header-count-limit'], type=int, help="Limit of http headers per request. Default 100, minimum 1.")
533-
534-
# Compose
535524
with self.argument_context('containerapp compose create') as c:
536525
c.argument('dry_run', options_list=['--dry-run'], arg_type=get_three_state_flag(),
537526
help='Preview deployment without creating actual Azure resources. Generates a detailed report of container apps, workload profiles, role assignments, and environment variable injections.')

src/containerapp/azext_containerapp/custom.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,6 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
18141814
gateway_fqdn = gateway_fqdn.replace('https://', f'{gateway_protocol}://')
18151815

18161816
# Extract and preserve the path from the original URL (e.g., /sse from http://mcp-gateway:8811/sse)
1817-
import re
18181817
path_match = re.search(r'://mcp-gateway(?::\d+)?(/[^\s]*)', var_value)
18191818
preserved_path = path_match.group(1) if path_match else ''
18201819

@@ -1843,7 +1842,6 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
18431842
gateway_fqdn = gateway_fqdn.replace('https://', f'{gateway_protocol}://')
18441843

18451844
# Extract and preserve the path from the original URL
1846-
import re
18471845
path_match = re.search(r'://mcp-gateway(?::\d+)?(/[^\s]*)', value)
18481846
preserved_path = path_match.group(1) if path_match else ''
18491847

@@ -2133,14 +2131,12 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
21332131
replicas=replicas,
21342132
is_models_service=(service_name == 'models'),
21352133
is_mcp_gateway=is_mcp_gateway,
2136-
gpu_type=gpu_profile.get('type') if (service_name == 'models' and 'gpu_profile' in locals()) else None,
2134+
gpu_type=raw_service_yaml.get('x-azure-deployment', {}).get('workloadProfiles', {}).get('workloadProfileType') if service_name == 'models' else None,
21372135
raw_service=raw_service_yaml,
21382136
models_config=models
21392137
)
21402138
dry_run_services.append(service_config)
21412139

2142-
# if service_name == 'models':
2143-
# dry_run_has_models = True
21442140
if is_mcp_gateway:
21452141
dry_run_has_gateway = True
21462142

@@ -2215,7 +2211,7 @@ def create_containerapps_from_compose(cmd, # pylint: disable=R0914
22152211
)
22162212

22172213
# Return empty list (no actual deployment)
2218-
return None # Dry-run complete, no resources created return containerapps_from_compose
2214+
return None # Dry-run complete, no resources created
22192215

22202216

22212217
def set_workload_profile(cmd, resource_group_name, env_name, workload_profile_name, workload_profile_type=None, min_nodes=None, max_nodes=None):

0 commit comments

Comments
 (0)