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

containerapp add containerapp-preview extension #6419

Merged
merged 54 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d0c524e
init containerapp-preview
Greedygre Jun 1, 2023
f7be550
add GA extension dependency
Greedygre Jun 6, 2023
d6d8f7c
add --environment-type
Greedygre Jun 6, 2023
93c8960
fix bug for prompt
Greedygre Jun 7, 2023
62debc5
warning for update extension
Greedygre Jun 7, 2023
a98d7d3
remove useless code
Greedygre Jun 7, 2023
12820f4
fix
Greedygre Jun 7, 2023
d948cdf
remove
Greedygre Jun 8, 2023
1bb1cea
remove setup
Greedygre Jun 8, 2023
2afbe83
fix
Greedygre Jun 8, 2023
42ab370
fix lint
Greedygre Jun 8, 2023
d6beff8
fix test
Greedygre Jun 8, 2023
0cf803f
test tbd
Greedygre Jun 8, 2023
9b9b237
test 0.0.0
Greedygre Jun 8, 2023
7c34333
add create containerapp
Greedygre Jun 13, 2023
1e81de8
fix
Greedygre Jun 13, 2023
ec88eb3
add env and environment type
Greedygre Jun 13, 2023
ac2c33c
set is preview
Greedygre Jun 13, 2023
bd96ab5
fix
Greedygre Jun 14, 2023
724a381
support --yaml with extended-location
Greedygre Jun 14, 2023
88eaa6a
fix extend
Greedygre Jun 15, 2023
94eebe4
add show/delete/list containerapp in preview
Greedygre Jun 16, 2023
6a4fb88
fix preview
Greedygre Jun 19, 2023
2a4a168
fix error
Greedygre Jun 19, 2023
8b17806
fix error
Greedygre Jun 19, 2023
c7410b7
rebase main
Greedygre Jun 19, 2023
4c9f52e
fix delete
Greedygre Jun 19, 2023
8cf2fc8
refactor client and make constants
Greedygre Jun 29, 2023
368fae6
add test for environment type on arc
Greedygre Jul 3, 2023
2618e94
set version
Greedygre Jul 3, 2023
22bb79a
add test yaml
Greedygre Jul 3, 2023
0f0ffb4
fix error
Greedygre Jul 3, 2023
958e075
fix containerapp preview test
Greedygre Jul 3, 2023
c8662e2
add rely GA extension in test
Greedygre Jul 3, 2023
5cd3762
fix test
Greedygre Jul 3, 2023
44e6078
remove useless code
Greedygre Jul 4, 2023
94be4f6
fix install for loading
Greedygre Jul 5, 2023
8cf778f
Update verify_linter.py
wangzelin007 Jul 4, 2023
5446f32
fix recording and set version to 1.0.0b1
Greedygre Jul 5, 2023
52533f7
fix static analysis: blank line at the end
Greedygre Jul 5, 2023
eb2b6e6
Update verify_linter.py
wangzelin007 Jul 5, 2023
fd55f66
fix comments
Greedygre Jul 6, 2023
2e799d9
remove blank line
Greedygre Jul 6, 2023
5faa2ca
remove python 3.6 support in setup and add more comments for command …
Greedygre Jul 6, 2023
37147a9
add test for managed, add helps, parse resource type and compare
Greedygre Jul 7, 2023
8ae8319
add blank line
Greedygre Jul 7, 2023
18f613d
remove prompt logic
Greedygre Jul 10, 2023
fd90a41
fix
Greedygre Jul 10, 2023
c592553
fix
Greedygre Jul 10, 2023
99e67f9
fix help
Greedygre Jul 10, 2023
03aa729
raise error in _get_azext_module
Greedygre Jul 11, 2023
26cf02c
fix comments
Greedygre Jul 11, 2023
a6d4f0d
add a blank line
Greedygre Jul 11, 2023
acecec6
rename _get_azext_containerapp_module
Greedygre Jul 11, 2023
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
Next Next commit
init containerapp-preview
  • Loading branch information
Greedygre committed Jul 10, 2023
commit d0c524ef57e7c95f785c2d5a5c5cb662ea775852
8 changes: 8 additions & 0 deletions src/containerapp-preview/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/containerapp-preview/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'containerapp-preview' Extension
==========================================

This package is for the 'containerapp-preview' extension.
i.e. 'az containerapp-preview'
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 31 additions & 0 deletions src/containerapp-preview/azext_containerapp_preview/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader

from azext_containerapp_preview._help import helps # pylint: disable=unused-import


class ContainerappPreviewCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
containerapp_preview_custom = CliCommandType(
operations_tmpl='azext_containerapp_preview.custom#{}',
client_factory=None)
super(ContainerappPreviewCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=containerapp_preview_custom)

def load_command_table(self, args):
from azext_containerapp_preview.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_containerapp_preview._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = ContainerappPreviewCommandsLoader
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
13 changes: 13 additions & 0 deletions src/containerapp-preview/azext_containerapp_preview/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.help_files import helps # pylint: disable=unused-import
Greedygre marked this conversation as resolved.
Show resolved Hide resolved


helps['containerapp-preview'] = """
type: group
short-summary: Commands to manage Containerapp-previews.
"""
20 changes: 20 additions & 0 deletions src/containerapp-preview/azext_containerapp_preview/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long

from knack.arguments import CLIArgumentType


def load_arguments(self, _):

from azure.cli.core.commands.parameters import tags_type
from azure.cli.core.commands.validators import get_default_location_from_resource_group

name_type = CLIArgumentType(options_list=['--name', '-n'])

with self.argument_context('containerapp') as c:
c.argument('tags', tags_type)
c.argument('location', validator=get_default_location_from_resource_group)
c.argument('name', name_type, options_list=['--name', '-n'])
20 changes: 20 additions & 0 deletions src/containerapp-preview/azext_containerapp_preview/_validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def example_name_or_id_validator(cmd, namespace):
# Example of a storage account name or ID validator.
# See: https://github.com/Azure/azure-cli/blob/dev/doc/authoring_command_modules/authoring_commands.md#supporting-name-or-id-parameters
from azure.cli.core.commands.client_factory import get_subscription_id
from msrestazure.tools import is_valid_resource_id, resource_id
if namespace.storage_account:
if not is_valid_resource_id(namespace.RESOURCE):
namespace.storage_account = resource_id(
subscription=get_subscription_id(cmd.cli_ctx),
resource_group=namespace.resource_group_name,
namespace='Microsoft.Storage',
type='storageAccounts',
name=namespace.storage_account
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.0.67",
"azext.maxCliCoreVersion": "2.1.0"
}
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
26 changes: 26 additions & 0 deletions src/containerapp-preview/azext_containerapp_preview/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# from azure.cli.core.commands import CliCommandType
# from azext_containerapp_preview._client_factory import cf_containerapp_preview


def load_command_table(self, _):

# TODO: Add command type here
# containerapp-preview_sdk = CliCommandType(
# operations_tmpl='<PATH>.operations#None.{}',
# client_factory=cf_containerapp-preview)

with self.command_group('containerapp') as g:
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
g.custom_command('create', 'create_containerapp-preview')
# g.command('delete', 'delete')
g.custom_command('list', 'list_containerapp-preview')
# g.show_command('show', 'get')
# g.generic_update_command('update', setter_name='update', custom_func_name='update_containerapp-preview')

with self.command_group('containerapp', is_preview=True):
pass
4 changes: 4 additions & 0 deletions src/containerapp-preview/azext_containerapp_preview/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
# -----------------------------------------------------------------------------
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import os
import unittest

from azure_devtools.scenario_tests import AllowLargeResponse
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer)


TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))


class Containerapp-previewScenarioTest(ScenarioTest):

@ResourceGroupPreparer(name_prefix='cli_test_containerapp-preview')
def test_containerapp-preview(self, resource_group):

self.kwargs.update({
'name': 'test1'
})

self.cmd('containerapp-preview create -g {rg} -n {name} --tags foo=doo', checks=[
self.check('tags.foo', 'doo'),
self.check('name', '{name}')
])
self.cmd('containerapp-preview update -g {rg} -n {name} --tags foo=boo', checks=[
self.check('tags.foo', 'boo')
])
count = len(self.cmd('containerapp-preview list').get_output_in_json())
self.cmd('containerapp-preview show - {rg} -n {name}', checks=[
self.check('name', '{name}'),
self.check('resourceGroup', '{rg}'),
self.check('tags.foo', 'boo')
])
self.cmd('containerapp-preview delete -g {rg} -n {name}')
final_count = len(self.cmd('containerapp-preview list').get_output_in_json())
self.assertTrue(final_count, count - 1)
Empty file.
58 changes: 58 additions & 0 deletions src/containerapp-preview/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python

# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


from codecs import open
from setuptools import setup, find_packages
try:
from azure_bdist_wheel import cmdclass
except ImportError:
from distutils import log as logger
logger.warn("Wheel is not available, disabling bdist_wheel hook")

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '0.1.0'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Greedygre marked this conversation as resolved.
Show resolved Hide resolved
'License :: OSI Approved :: MIT License',
]

# TODO: Add any additional SDK dependencies here
DEPENDENCIES = []

with open('README.rst', 'r', encoding='utf-8') as f:
README = f.read()
with open('HISTORY.rst', 'r', encoding='utf-8') as f:
HISTORY = f.read()

setup(
name='containerapp-preview',
version=VERSION,
description='Microsoft Azure Command-Line Tools Containerapp-preview Extension',
# TODO: Update author and email, if applicable
author='Microsoft Corporation',
author_email='azpycli@microsoft.com',
# TODO: change to your extension source code repo if the code will not be put in azure-cli-extensions repo
url='https://github.com/Azure/azure-cli-extensions/tree/master/src/containerapp-preview',
long_description=README + '\n\n' + HISTORY,
license='MIT',
classifiers=CLASSIFIERS,
packages=find_packages(),
install_requires=DEPENDENCIES,
package_data={'azext_containerapp_preview': ['azext_metadata.json']},
)