[spring-cloud] Refactor app create update and deploy logic#4266
[spring-cloud] Refactor app create update and deploy logic#4266zhoxing-ms merged 9 commits intoAzure:mainfrom
Conversation
| g.custom_command('repo list', 'config_repo_list') | ||
|
|
||
| with self.command_group('spring-cloud app', client_factory=cf_spring_cloud_20220101preview, | ||
| with self.command_group('spring-cloud app', custom_command_type=app_command, |
There was a problem hiding this comment.
The 4 commands' traffic will be routing to the app.py
spring-cloud app createspring-cloud app updatespring-cloud app deployspring-cloud app deployment create
|
spring-cloud |
|
ready_to_review |
| raise CLIError("Failed to get a SAS URL to upload context.") | ||
| return response | ||
| except CloudError as e: | ||
| raise CLIError("Failed to get a SAS URL to upload context. Error: {}".format(e.message)) | ||
| except AttributeError as e: | ||
| raise CLIError("Failed to get a SAS URL to upload context. Error: {}".format(e)) |
There was a problem hiding this comment.
Please use the specific error type instead of CLIError
| app, | ||
| build).properties.triggered_build_result.id | ||
| except (AttributeError, CloudError) as e: | ||
| raise CLIError("Failed to create or update a build. Error: {}".format(e.message)) |
|
|
||
| if result.properties.provisioning_state != "Succeeded": | ||
| log_url = self._try_get_build_log_url(build_result_id) | ||
| raise CLIError("Failed to build docker image, please check the build logs {} and retry.".format(log_url)) |
| # ignore | ||
| return | ||
| if app: | ||
| raise CLIError('App {} already exist.'.format(app.id)) |
| from azure.core.exceptions import (ResourceNotFoundError) | ||
| from ._client_factory import cf_spring_cloud | ||
| from ._resource_quantity import (validate_cpu as validate_cpu_value, validate_memory as validate_memory_value) | ||
| from ._client_factory import cf_spring_cloud_20220101preview |
There was a problem hiding this comment.
May I ask why did you add the api-version number to the name of _client_factory ?
There was a problem hiding this comment.
Here follows the current implementation about client factory. The default client factory uses the latest stable API version. But some features in previewed is only available in preview API version. Ideally, we, service team will flush all preview features in a new stable API version, at that time, we can remove the factory_preview_api_version and replace them as the new default client factory.
This PR refactors the logic when app create, app deploy, app update and deployment create.
App's command usually operates an Spring/Apps and the active Spring/Apps/Deployments under the app.
The general idea of these command is putting all input command in parameter dict and let the Resource factory to construct the payload.
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update
src/index.jsonautomatically.The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify
src/index.json.