Skip to content

Commit

Permalink
[Spring] Add 'language_framework' param for BYOC. (#5363)
Browse files Browse the repository at this point in the history
* [Spring] Add 'language_framework' param for BYOC.

* Update the test cases.

* update the history.md.

Co-authored-by: Raphael Yu <xiangy@microsoft.com>
  • Loading branch information
LGDoor and LGDoor authored Sep 22, 2022
1 parent 3008dc9 commit 0869ce0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
===============

1.1.8
---
* Add the parameter `language_framework` for deploying the customer image app.

1.1.7
---
* Update `minCliCoreVersion` requirement from `2.30.0` to `2.38.0`.
Expand Down
3 changes: 2 additions & 1 deletion src/spring/azext_spring/_deployment_source_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def format_source(self, version=None, **kwargs):

def _format_container(self, container_registry=None, container_image=None,
container_command=None, container_args=None,
registry_username=None, registry_password=None, **_):
registry_username=None, registry_password=None, language_framework=None, **_):
if all(x is None for x in [container_image,
container_command, container_args,
registry_username, registry_password]):
Expand All @@ -121,6 +121,7 @@ def _format_container(self, container_registry=None, container_image=None,
command=container_command,
args=container_args,
image_registry_credential=credential,
language_framework=language_framework
)


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 @@ -425,6 +425,8 @@ def prepare_logs_argument(c):
'container_command', help='The command of the container image.', arg_group='Custom Container')
c.argument(
'container_args', help='The arguments of the container image.', arg_group='Custom Container')
c.argument(
'language_framework', help='Language framework of the container image uploaded. Supported values: "springboot", "".', arg_group='Custom Container')
c.argument(
'build_env', build_env_type)
c.argument(
Expand Down
4 changes: 4 additions & 0 deletions src/spring/azext_spring/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ def app_deploy(cmd, client, resource_group, service, name,
registry_password=None,
container_command=None,
container_args=None,
language_framework=None,
build_env=None,
builder=None,
build_cpu=None,
Expand Down Expand Up @@ -336,6 +337,7 @@ def app_deploy(cmd, client, resource_group, service, name,
'registry_password': registry_password,
'container_command': container_command,
'container_args': container_args,
'language_framework': language_framework,
'build_env': build_env,
'build_cpu': build_cpu,
'build_memory': build_memory,
Expand Down Expand Up @@ -388,6 +390,7 @@ def deployment_create(cmd, client, resource_group, service, app, name,
registry_password=None,
container_command=None,
container_args=None,
language_framework=None,
build_env=None,
builder=None,
# deployment.settings
Expand Down Expand Up @@ -441,6 +444,7 @@ def deployment_create(cmd, client, resource_group, service, app, name,
'registry_password': registry_password,
'container_command': container_command,
'container_args': container_args,
'language_framework': language_framework,
'cpu': cpu,
'memory': memory,
'instance_count': instance_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2945,7 +2945,7 @@ interactions:
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview
response:
body:
string: '{"properties":{"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":90,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-container-green-14-686569db65-wm6fr","status":"Running","discoveryStatus":"N/A","startTime":"2022-09-13T07:00:33Z"}],"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}}},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"caihuarui@microsoft.com","createdByType":"User","createdAt":"2022-09-13T07:00:22.798376Z","lastModifiedBy":"caihuarui@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-09-13T07:00:22.798376Z"}}'
string: '{"properties":{"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":90,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-container-green-14-686569db65-wm6fr","status":"Running","discoveryStatus":"N/A","startTime":"2022-09-13T07:00:33Z"}],"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io","languageFramework":"springboot"}}},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"caihuarui@microsoft.com","createdByType":"User","createdAt":"2022-09-13T07:00:22.798376Z","lastModifiedBy":"caihuarui@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-09-13T07:00:22.798376Z"}}'
headers:
cache-control:
- no-cache
Expand Down
4 changes: 3 additions & 1 deletion src/spring/azext_spring/tests/latest/test_asa_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def test_app_deploy_container(self):
self.check('name', 'default'),
self.check('properties.source.type', 'Container'),
self.check('properties.source.customContainer.containerImage', '{containerImage}'),
self.check('properties.source.customContainer.languageFramework', None),
])

self.cmd('spring app deploy -g {resourceGroup} -s {serviceName} -n {app} --container-image {containerImage} --container-command "java" --container-args "-cp /app/resources:/app/classes:/app/libs/* hello.Application"', checks=[
Expand All @@ -223,8 +224,9 @@ def test_app_deploy_container(self):
self.check('properties.source.customContainer.args', ['-cp', '/app/resources:/app/classes:/app/libs/*', 'hello.Application']),
])

self.cmd('spring app deployment create -g {resourceGroup} -s {serviceName} --app {app} -n green --container-image {containerImage}', checks=[
self.cmd('spring app deployment create -g {resourceGroup} -s {serviceName} --app {app} -n green --container-image {containerImage} --language-framework springboot', checks=[
self.check('name', 'green'),
self.check('properties.source.type', 'Container'),
self.check('properties.source.customContainer.containerImage', '{containerImage}'),
self.check('properties.source.customContainer.languageFramework', 'springboot'),
])

0 comments on commit 0869ce0

Please sign in to comment.