-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[AppService] functionapp: Updated container image configuration for Linux apps #12317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,39 +39,18 @@ | |
| 'java': '8' | ||
| } | ||
| } | ||
| # functions version -> runtime -> runtime version : container image | ||
| RUNTIME_TO_IMAGE_FUNCTIONAPP = { | ||
| # functions version -> runtime : runtime versions | ||
| RUNTIME_TO_SUPPORTED_VERSIONS_FUNCTIONAPP = { | ||
|
gzuber marked this conversation as resolved.
Outdated
|
||
| '2': { | ||
| 'node': { | ||
| '8': 'mcr.microsoft.com/azure-functions/node:2.0-node8-appservice', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will the values like 'mcr.microsoft.com/azure-functions/node:2.0-node8-appservice' not be used any more?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct -- the back end has been updated to know which container image to use, so it's not something we have to set here anymore |
||
| '10': 'mcr.microsoft.com/azure-functions/node:2.0-node10-appservice' | ||
| }, | ||
| 'python': { | ||
| '3.6': 'mcr.microsoft.com/azure-functions/python:2.0-python3.6-appservice', | ||
| '3.7': 'mcr.microsoft.com/azure-functions/python:2.0-python3.7-appservice' | ||
| }, | ||
| 'dotnet': { | ||
| '2': 'mcr.microsoft.com/azure-functions/dotnet:2.0-appservice' | ||
| }, | ||
| 'java': { | ||
| '8': 'mcr.microsoft.com/azure-functions/java:2.0-java8-appservice' | ||
| } | ||
| 'node': ['8', '10'], | ||
| 'python': ['3.6', '3.7'], | ||
| 'dotnet': ['2'], | ||
| 'java': ['8'] | ||
| }, | ||
| '3': { | ||
| 'node': { | ||
| '10': 'mcr.microsoft.com/azure-functions/node:3.0-node10-appservice', | ||
| '12': 'mcr.microsoft.com/azure-functions/node:3.0-node12-appservice' | ||
| }, | ||
| 'python': { | ||
| '3.6': 'mcr.microsoft.com/azure-functions/python:3.0-python3.6-appservice', | ||
| '3.7': 'mcr.microsoft.com/azure-functions/python:3.0-python3.7-appservice', | ||
| '3.8': 'mcr.microsoft.com/azure-functions/python:3.0-python3.8-appservice' | ||
| }, | ||
| 'dotnet': { | ||
| '3': 'mcr.microsoft.com/azure-functions/dotnet:3.0-appservice' | ||
| }, | ||
| 'java': { | ||
| '8': 'mcr.microsoft.com/azure-functions/java:3.0-java8-appservice' | ||
| } | ||
| 'node': ['10', '12'], | ||
| 'python': ['3.6', '3.7', '3.8'], | ||
| 'dotnet': ['3'], | ||
|
gzuber marked this conversation as resolved.
|
||
| 'java': ['8'] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,7 +58,7 @@ | |||||||
| get_plan_to_use, get_lang_from_content, get_rg_to_use, get_sku_to_use, | ||||||||
| detect_os_form_src) | ||||||||
| from ._constants import (RUNTIME_TO_DEFAULT_VERSION_FUNCTIONAPP, NODE_VERSION_DEFAULT_FUNCTIONAPP, | ||||||||
| RUNTIME_TO_IMAGE_FUNCTIONAPP, NODE_VERSION_DEFAULT) | ||||||||
| RUNTIME_TO_SUPPORTED_VERSIONS_FUNCTIONAPP, NODE_VERSION_DEFAULT) | ||||||||
|
|
||||||||
| logger = get_logger(__name__) | ||||||||
|
|
||||||||
|
|
@@ -2394,7 +2394,7 @@ def create_function(cmd, resource_group_name, name, storage_account, plan=None, | |||||||
| if runtime_version is not None: | ||||||||
| if runtime is None: | ||||||||
| raise CLIError('Must specify --runtime to use --runtime-version') | ||||||||
| allowed_versions = RUNTIME_TO_IMAGE_FUNCTIONAPP[functions_version][runtime].keys() | ||||||||
| allowed_versions = RUNTIME_TO_SUPPORTED_VERSIONS_FUNCTIONAPP[functions_version][runtime] | ||||||||
| if runtime_version not in allowed_versions: | ||||||||
|
gzuber marked this conversation as resolved.
|
||||||||
| raise CLIError('--runtime-version {} is not supported for the selected --runtime {} and ' | ||||||||
| '--functions_version {}. Supported versions are: {}' | ||||||||
|
|
@@ -2420,13 +2420,10 @@ def create_function(cmd, resource_group_name, name, storage_account, plan=None, | |||||||
| else: | ||||||||
| site_config.app_settings.append(NameValuePair(name='WEBSITES_ENABLE_APP_SERVICE_STORAGE', | ||||||||
| value='true')) | ||||||||
| if runtime not in RUNTIME_TO_IMAGE_FUNCTIONAPP[functions_version].keys(): | ||||||||
| if runtime not in RUNTIME_TO_SUPPORTED_VERSIONS_FUNCTIONAPP[functions_version]: | ||||||||
| raise CLIError("An appropriate linux image for runtime:'{}' was not found".format(runtime)) | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include runtime version in the error message
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if the user specifies a azure-cli/src/azure-cli/azure/cli/command_modules/appservice/custom.py Lines 2399 to 2401 in dd691a3
I added |
||||||||
| if deployment_container_image_name is None: | ||||||||
| site_config.linux_fx_version = _get_linux_fx_functionapp(is_consumption, | ||||||||
| functions_version, | ||||||||
| runtime, | ||||||||
| runtime_version) | ||||||||
| site_config.linux_fx_version = _get_linux_fx_functionapp(functions_version, runtime, runtime_version) | ||||||||
| else: | ||||||||
| functionapp_def.kind = 'functionapp' | ||||||||
| # adding appsetting to site to make it a function | ||||||||
|
|
@@ -2466,8 +2463,8 @@ def create_function(cmd, resource_group_name, name, storage_account, plan=None, | |||||||
| functionapp = LongRunningOperation(cmd.cli_ctx)(poller) | ||||||||
|
|
||||||||
| if consumption_plan_location and is_linux: | ||||||||
| logger.warning("Your Linux function app '%s', that uses a consumption plan has been successfully" | ||||||||
| "created but is not active until content is published using" | ||||||||
| logger.warning("Your Linux function app '%s', that uses a consumption plan has been successfully " | ||||||||
| "created but is not active until content is published using " | ||||||||
| "Azure Portal or the Functions Core Tools.", name) | ||||||||
| else: | ||||||||
| _set_remote_or_local_git(cmd, functionapp, resource_group_name, name, deployment_source_url, | ||||||||
|
|
@@ -2494,13 +2491,10 @@ def _get_extension_version_functionapp(functions_version): | |||||||
| return '~2' | ||||||||
|
|
||||||||
|
|
||||||||
| def _get_linux_fx_functionapp(is_consumption, functions_version, runtime, runtime_version): | ||||||||
| def _get_linux_fx_functionapp(functions_version, runtime, runtime_version): | ||||||||
| if runtime_version is None: | ||||||||
| runtime_version = RUNTIME_TO_DEFAULT_VERSION_FUNCTIONAPP[functions_version][runtime] | ||||||||
| if is_consumption: | ||||||||
| return '{}|{}'.format(runtime.upper(), runtime_version) | ||||||||
| # App service or Elastic Premium | ||||||||
| return _format_fx_version(RUNTIME_TO_IMAGE_FUNCTIONAPP[functions_version][runtime][runtime_version]) | ||||||||
| return '{}|{}'.format(runtime.upper(), runtime_version) | ||||||||
|
gzuber marked this conversation as resolved.
|
||||||||
|
|
||||||||
|
|
||||||||
| def _get_website_node_version_functionapp(functions_version, runtime, runtime_version): | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as in another PR, history.rst is automatically generated from PR titles. Pls refine PR titles and no need to change this file.