-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[functionapp] Add support for v3 function apps and node 12. #11987
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
from azure.mgmt.web.models import DatabaseType, ConnectionStringType, BuiltInAuthenticationProvider, AzureStorageType | ||
|
||
from ._completers import get_hostname_completion_list | ||
from ._constants import RUNTIME_TO_IMAGE_FUNCTIONAPP | ||
from ._constants import HOST_VERSIONS_FUNCTIONAPP, RUNTIME_TO_IMAGE_FUNCTIONAPP | ||
from ._validators import (validate_timeout_value, validate_site_create, validate_asp_create, | ||
validate_add_vnet, validate_front_end_scale_factor, validate_ase_create) | ||
|
||
|
@@ -50,9 +50,17 @@ def load_arguments(self, _): | |
isolated_sku_arg_type = CLIArgumentType(help='The Isolated pricing tiers, e.g., I1 (Isolated Small), I2 (Isolated Medium), I3 (Isolated Large)', | ||
arg_type=get_enum_type(['I1', 'I2', 'I3'])) | ||
|
||
# combine all runtime versions for all functions host versions | ||
functionapp_runtime_to_version = {} | ||
for version in RUNTIME_TO_IMAGE_FUNCTIONAPP.values(): | ||
for runtime, val in version.items(): | ||
functionapp_runtime_to_version[runtime] = functionapp_runtime_to_version.get(runtime, set()).union(val.keys()) | ||
|
||
functionapp_runtime_to_version_texts = [] | ||
for runtime, val in RUNTIME_TO_IMAGE_FUNCTIONAPP.items(): | ||
functionapp_runtime_to_version_texts.append(runtime + ' -> [' + ', '.join(val.keys()) + ']') | ||
for runtime, runtime_versions in functionapp_runtime_to_version.items(): | ||
runtime_versions_list = list(runtime_versions) | ||
runtime_versions_list.sort(key=float) | ||
functionapp_runtime_to_version_texts.append(runtime + ' -> [' + ', '.join(runtime_versions_list) + ']') | ||
|
||
# use this hidden arg to give a command the right instance, that functionapp commands | ||
# work on function app and webapp ones work on web app | ||
|
@@ -460,6 +468,7 @@ def load_arguments(self, _): | |
help='Provide a string value of a Storage Account in the provided Resource Group. Or Resource ID of a Storage Account in a different Resource Group') | ||
c.argument('consumption_plan_location', options_list=['--consumption-plan-location', '-c'], | ||
help="Geographic location where Function App will be hosted. Use `az functionapp list-consumption-locations` to view available locations.") | ||
c.argument('version', options_list=['--version', '-v'], help='The functions runtime version.', arg_type=get_enum_type(HOST_VERSIONS_FUNCTIONAPP), configured_default='2') | ||
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. Maybe more description about version 2 and 3. I don't know which one I should choose. |
||
c.argument('runtime', help='The functions runtime stack.', arg_type=get_enum_type(set(LINUX_RUNTIMES).union(set(WINDOWS_RUNTIMES)))) | ||
c.argument('runtime_version', help='The version of the functions runtime stack. ' | ||
'Allowed values for each --runtime are: ' + ', '.join(functionapp_runtime_to_version_texts)) | ||
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. Can we put all available versions here and delete --version? What's the difference between version 2 and 3 when choosing same runtime and runtime_version? 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.
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. To chime in...it took me a minute to figure this out when I was first ramping up. Maybe we scrub docs to ensure that we clearly describe the differences. 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. I see. Thanks for the detailed explanation. |
||
|
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.
The set will perform auto sort, we don't need to do this explicitly.
The next line
', '.join
will iterate through the set. So we may not need these two lines.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.
Yeah so this was a bit frustrating because if I just join the set, it'll print out node versions as "8, 12, 10" for some reason. I can't sort the set so if I turn it into a list and sort it, it'll print "10, 12, 8" because 1 comes before 8. Setting the
key
tofloat
will sort them as if they're floats and behave how we would want.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.
OK, I see, yea, that makes sense. We can keep them here.