Skip to content
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

[App Service] BREAKING CHANGE: az webapp list-runtimes: Use new stacks APIs #21057

Merged
merged 48 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f1bab4e
WIP
StrawnSC Nov 10, 2021
fc7c00b
WIP
StrawnSC Dec 2, 2021
8b29533
WIP
StrawnSC Dec 2, 2021
a2bc4cc
WIP
StrawnSC Dec 2, 2021
48d6318
finish list runtimes impl and switch to new argument usage -- webapp …
StrawnSC Dec 2, 2021
ba0bfe2
fix az webapp create
StrawnSC Dec 2, 2021
bbe5d37
WIP
StrawnSC Jan 18, 2022
2675935
WIP
StrawnSC Jan 18, 2022
dd8e907
WIP
StrawnSC Jan 19, 2022
215d441
WIP
StrawnSC Jan 19, 2022
d70e741
fix tests
StrawnSC Jan 19, 2022
39755c9
fix tests
StrawnSC Jan 19, 2022
112f2c3
fix tests
StrawnSC Jan 19, 2022
02914e2
fix tests
StrawnSC Jan 19, 2022
2676c6d
fix test_webapp_up_python_e2e
StrawnSC Jan 19, 2022
1cfc519
fix test_webapp_up_statichtml_e2e
StrawnSC Jan 19, 2022
7ee6cc5
use runtime objects over dicts and include ease of use runtime name r…
StrawnSC Jan 21, 2022
5b5eb65
mark flaky tests to skip them
StrawnSC Jan 21, 2022
b34122d
bug fix
StrawnSC Jan 21, 2022
7b311c0
bug fix
StrawnSC Jan 21, 2022
ca08b9c
bug fix
StrawnSC Jan 21, 2022
7cfbe94
fix style
StrawnSC Jan 21, 2022
7b6e3a4
merge dev
StrawnSC Jan 21, 2022
9ca2670
rerecord webapp tests
StrawnSC Jan 21, 2022
ff9776f
rectify webapp up tests
StrawnSC Jan 21, 2022
cdbdab9
rectify webapp up tests again
StrawnSC Jan 21, 2022
d0d380f
remove erroneous import
StrawnSC Jan 21, 2022
57dede0
update webapp up test
StrawnSC Jan 21, 2022
c78a60e
update webapp up test
StrawnSC Jan 21, 2022
41a65ce
rerecord webapp access restriction tests
StrawnSC Jan 21, 2022
5d80a50
fix credscan fail
StrawnSC Jan 24, 2022
7dbdd2c
fix windows java SE configs
StrawnSC Jan 24, 2022
dceb351
merge dev
StrawnSC Jan 26, 2022
9fb5293
return both windows and linux stacks by default
StrawnSC Jan 26, 2022
9e7f061
use --os argument over --windows
StrawnSC Jan 26, 2022
b791493
implement 'az functionapp list-runtimes'
StrawnSC Jan 28, 2022
2501e72
change '(WIP) az functionapp create' to use new runtimes API ; still …
StrawnSC Jan 31, 2022
0841b82
rerecord 'test_functionapp_commands' tests
StrawnSC Feb 1, 2022
877d889
rerecord more tests
StrawnSC Feb 1, 2022
06d8743
Merge branch 'dev' into unhardcode_webapp_list-runtimes
StrawnSC Feb 1, 2022
d8d886d
fix GH actions
StrawnSC Feb 1, 2022
90687ad
remove function app stacks JSON file
StrawnSC Feb 2, 2022
92fab03
Merge branch 'dev' into unhardcode_webapp_list-runtimes
StrawnSC Feb 8, 2022
365cfb4
add back hardcoded function; use colon delimiter; fix deprecation
StrawnSC Feb 8, 2022
b2ddda3
remove creds from recordings
StrawnSC Feb 9, 2022
b8f7a91
add back appservice package data
StrawnSC Feb 9, 2022
15eca32
Merge branch 'dev' into unhardcode_webapp_list-runtimes
StrawnSC Feb 10, 2022
896da30
dummy commit to rerun CI
StrawnSC Feb 10, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
NODE_RUNTIME_NAME = "node"
PYTHON_RUNTIME_NAME = "python"
OS_DEFAULT = "Windows"
LINUX_OS_NAME = "linux"
WINDOWS_OS_NAME = "windows"
STATIC_RUNTIME_NAME = "static" # not an official supported runtime but used for CLI logic
LINUX_SKU_DEFAULT = "P1V2"
FUNCTIONS_VERSIONS = ['2', '3', '4']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
from azure.mgmt.web.models import DatabaseType, ConnectionStringType, BuiltInAuthenticationProvider, AzureStorageType

from ._completers import get_hostname_completion_list
from ._constants import FUNCTIONS_VERSIONS, FUNCTIONS_STACKS_API_JSON_PATHS, FUNCTIONS_STACKS_API_KEYS
from ._constants import (FUNCTIONS_VERSIONS, FUNCTIONS_STACKS_API_JSON_PATHS, FUNCTIONS_STACKS_API_KEYS,
WINDOWS_OS_NAME, LINUX_OS_NAME)

from ._validators import (validate_timeout_value, validate_site_create, validate_asp_create,
validate_add_vnet, validate_front_end_scale_factor, validate_ase_create, validate_ip_address,
validate_service_tag, validate_public_cloud)
Expand Down Expand Up @@ -170,8 +172,8 @@ def load_arguments(self, _):
c.argument('slot', options_list=['--slot', '-s'], help='Name of the web app slot. Default to the productions slot if not specified.')

with self.argument_context('webapp list-runtimes') as c:
StrawnSC marked this conversation as resolved.
Show resolved Hide resolved
c.argument('linux', options_list=['--linux', '-l'], action='store_true', help='list runtime stacks for linux based web apps')
StrawnSC marked this conversation as resolved.
Show resolved Hide resolved
c.argument('windows', options_list=['--windows', '-w'], action='store_true', help='list runtime stacks for windows based web apps')
c.argument('linux', action='store_true', help='list runtime stacks for linux based web apps. Use "--os-type linux" instead', deprecate_info=c.deprecate())
StrawnSC marked this conversation as resolved.
Show resolved Hide resolved
c.argument('os_type', options_list=["--os", "--os-type"], help="limit the output to just windows or linux runtimes", arg_type=get_enum_type([LINUX_OS_NAME, WINDOWS_OS_NAME]))

with self.argument_context('webapp deleted list') as c:
c.argument('name', arg_type=webapp_name_arg_type, id_part=None)
Expand Down
27 changes: 19 additions & 8 deletions src/azure-cli/azure/cli/command_modules/appservice/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
FUNCTIONS_LINUX_RUNTIME_VERSION_REGEX, FUNCTIONS_WINDOWS_RUNTIME_VERSION_REGEX,
RUNTIME_STACKS, FUNCTIONS_NO_V2_REGIONS, PUBLIC_CLOUD,
LINUX_GITHUB_ACTIONS_WORKFLOW_TEMPLATE_PATH, WINDOWS_GITHUB_ACTIONS_WORKFLOW_TEMPLATE_PATH,
DOTNET_RUNTIME_NAME, NETCORE_RUNTIME_NAME, ASPDOTNET_RUNTIME_NAME)
DOTNET_RUNTIME_NAME, NETCORE_RUNTIME_NAME, ASPDOTNET_RUNTIME_NAME, LINUX_OS_NAME,
WINDOWS_OS_NAME)
from ._github_oauth import (get_github_access_token)
from ._validators import validate_and_convert_to_int, validate_range_of_int_flag

Expand Down Expand Up @@ -1094,10 +1095,22 @@ def list_instances(cmd, resource_group_name, name, slot=None):
return _generic_site_operation(cmd.cli_ctx, resource_group_name, name, 'list_instance_identifiers', slot)


def list_runtimes(cmd, linux=False, windows=False):
if not linux and not windows: # show both linux and windows stacks by default
def list_runtimes(cmd, os_type=None, linux=False):
if os_type is not None and linux:
raise MutuallyExclusiveArgumentError("Cannot use both --os-type and --linux")

if linux:
linux = True
windows = False
else:
# show both linux and windows stacks by default
linux = True
windows = True
if os_type == WINDOWS_OS_NAME:
linux = False
if os_type == LINUX_OS_NAME:
windows = False

runtime_helper = _StackRuntimeHelper(cmd=cmd, linux=linux, windows=windows)
return runtime_helper.get_stack_names_only()

Expand Down Expand Up @@ -4053,11 +4066,9 @@ def webapp_up(cmd, name=None, resource_group_name=None, plan=None, location=None
runtime = helper.remove_delimiters(runtime)
match = helper.resolve(runtime, _is_linux)
if not match:
if _is_linux:
raise ValidationError("Linux runtime '{}' is not supported."
" Please invoke 'az webapp list-runtimes --linux' to cross check".format(runtime))
raise ValidationError("Windows runtime '{}' is not supported."
" Please invoke 'az webapp list-runtimes --windows' to cross check".format(runtime))
os_name = WINDOWS_OS_NAME if not _is_linux else LINUX_OS_NAME
raise ValidationError("{0} runtime '{1}' is not supported. Please check supported runtimes with: "
"'az webapp list-runtimes --os {0}'".format(os_name, runtime))

language = runtime.split('|')[0]
version_used_create = '|'.join(runtime.split('|')[1:])
Expand Down
Loading