Skip to content

Commit 5bfb856

Browse files
authored
Merge pull request Azure#144 from StrawnSC/aca_create_bug
Fix bug with `az containerapp create`
2 parents c66276c + a285f20 commit 5bfb856

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

src/containerapp/HISTORY.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Release History
55

66
0.3.10
77
++++++
8-
8+
* 'az containerapp create': Fix bug with --image caused by assuming a value for --registry-server
99

1010
0.3.9
1111
++++++

src/containerapp/azext_containerapp/custom.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@ def create_containerapp(cmd,
329329
disable_warnings=False,
330330
user_assigned=None,
331331
registry_identity=None):
332-
if image and "/" in image and not registry_server:
333-
registry_server = image[:image.index("/")]
334332
register_provider_if_needed(cmd, CONTAINER_APPS_RP)
335333
validate_container_app_name(name)
336334
validate_create(registry_identity, registry_pass, registry_user, registry_server, no_wait)

src/containerapp/azext_containerapp/tests/latest/test_containerapp_commands.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,34 @@ def test_containerapp_revision_label_e2e(self, resource_group):
561561
self.assertEqual(len([w for w in traffic_weight if "label" in w]), 0)
562562

563563

564+
class ContainerappAnonymousRegistryTests(ScenarioTest):
565+
@AllowLargeResponse(8192)
566+
@ResourceGroupPreparer(location="northeurope")
567+
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
568+
def test_containerapp_anonymous_registry(self, resource_group):
569+
import requests
570+
571+
env = self.create_random_name(prefix='env', length=24)
572+
app = self.create_random_name(prefix='aca', length=24)
573+
image = "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest"
574+
575+
self.cmd(f'containerapp env create -g {resource_group} -n {env}')
576+
577+
containerapp_env = self.cmd(f'containerapp env show -g {resource_group} -n {env}').get_output_in_json()
578+
579+
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
580+
time.sleep(5)
581+
containerapp_env = self.cmd(f'containerapp env show -g {resource_group} -n {env}').get_output_in_json()
582+
583+
self.cmd(f'containerapp create -g {resource_group} -n {app} --image {image} --ingress external --target-port 80 --environment {env}')
584+
585+
url = self.cmd(f'containerapp show -g {resource_group} -n {app}').get_output_in_json()["properties"]["configuration"]["ingress"]["fqdn"]
586+
url = f"https://{url}"
587+
resp = requests.get(url)
588+
self.assertTrue(resp.ok)
589+
self.assertEqual(resp.status_code, 200)
590+
591+
564592
class ContainerappRegistryIdentityTests(ScenarioTest):
565593
@AllowLargeResponse(8192)
566594
@ResourceGroupPreparer(location="westeurope")

0 commit comments

Comments
 (0)