Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Release History
===============
1.7.0
---
* Add argument `--deployment-name` in command `az spring app create`.

1.6.1
---
* Add type check for argument `--artifact-path`.
Expand Down
2 changes: 2 additions & 0 deletions src/spring/azext_spring/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ def load_arguments(self, _):
help='A json file path for the persistent storages to be mounted to the app')
c.argument('loaded_public_certificate_file', options_list=['--loaded-public-certificate-file', '-f'], type=str,
help='A json file path indicates the certificates which would be loaded to app')
c.argument('deployment_name', type=str, default='default',
help='Name of the default deployment.', validator=validate_name)

with self.argument_context('spring app update') as c:
c.argument('assign_endpoint', arg_type=get_three_state_flag(),
Expand Down
6 changes: 4 additions & 2 deletions src/spring/azext_spring/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@


def app_create(cmd, client, resource_group, service, name,
deployment_name=None,
# deployment.settings
cpu=None,
memory=None,
Expand Down Expand Up @@ -143,12 +144,13 @@ def app_create(cmd, client, resource_group, service, name,
app_poller = client.apps.begin_create_or_update(resource_group, service, name, app_resource)
wait_till_end(cmd, app_poller)

logger.warning('[2/3] Creating default deployment with name "{}"'.format(DEFAULT_DEPLOYMENT_NAME))
banner_deployment_name=deployment_name or DEFAULT_DEPLOYMENT_NAME
logger.warning('[2/3] Creating default deployment with name "{}"'.format(banner_deployment_name))
deployment_resource = deployment_factory.format_resource(**create_deployment_kwargs, **basic_kwargs)
poller = client.deployments.begin_create_or_update(resource_group,
service,
name,
DEFAULT_DEPLOYMENT_NAME,
banner_deployment_name,
deployment_resource)
logger.warning('[3/3] Updating app "{}" (this operation can take a while to complete)'.format(name))
app_resource = app_factory.format_resource(**update_app_kwargs, **basic_kwargs)
Expand Down
7 changes: 6 additions & 1 deletion src/spring/azext_spring/tests/latest/test_asa_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ def _execute(self, *args, **kwargs):
call_args = client.deployments.begin_create_or_update.call_args_list
self.assertEqual(1, len(call_args))
self.assertEqual(5, len(call_args[0][0]))
self.assertEqual(args[0:3] + ('default',), call_args[0][0][0:4])
self.put_deployment_resource = call_args[0][0][4]
self.put_deployment_resource.name = call_args[0][0][3]

call_args = client.apps.begin_update.call_args_list
self.assertEqual(1, len(call_args))
Expand Down Expand Up @@ -693,6 +693,11 @@ def test_app_with_client_auth(self):
resource = self.patch_app_resource
self.assertIsNone(resource.properties.ingress_settings)

def test_app_create_with_deployment_name(self):
self._execute('rg', 'asc', 'app', cpu='1', memory='1Gi', instance_count=1, deployment_name='hello')
resource = self.put_deployment_resource
self.assertEqual('hello', resource.name)

class TestDeploymentCreate(BasicTest):
def __init__(self, methodName: str = ...):
super().__init__(methodName=methodName)
Expand Down
2 changes: 1 addition & 1 deletion src/spring/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '1.6.1'
VERSION = '1.7.0'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down