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

ContainerApps 04/19 Release #4689

Merged
merged 20 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@

/src/quota/ @kairu-ms @ZengTaoxu

/src/containerapp/ @calvinsID @haroonf @panchagnula
/src/containerapp/ @calvinsID @haroonf @panchagnula @StrawnSC

/src/scvmm/ @nascarsayan

4 changes: 4 additions & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.3.1
++++++
* Update "az containerapp github-action add" parameters: replace --docker-file-path with --context-path, add --image.

0.3.0
++++++
* Subgroup commands for managed identities: az containerapp identity
Expand Down
53 changes: 27 additions & 26 deletions src/containerapp/azext_containerapp/_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
logger = get_logger(__name__)

API_VERSION = "2021-03-01"
NEW_API_VERSION = "2022-01-01-preview"
PREVIEW_API_VERSION = "2022-01-01-preview"
STABLE_API_VERSION = "2022-03-01"
POLLING_TIMEOUT = 60 # how many seconds before exiting
POLLING_SECONDS = 2 # how many seconds between requests

Expand Down Expand Up @@ -73,7 +74,7 @@ class ContainerAppClient():
@classmethod
def create_or_update(cls, cmd, resource_group_name, name, container_app_envelope, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -102,7 +103,7 @@ def create_or_update(cls, cmd, resource_group_name, name, container_app_envelope
@classmethod
def update(cls, cmd, resource_group_name, name, container_app_envelope, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -131,7 +132,7 @@ def update(cls, cmd, resource_group_name, name, container_app_envelope, no_wait=
@classmethod
def delete(cls, cmd, resource_group_name, name, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -165,7 +166,7 @@ def delete(cls, cmd, resource_group_name, name, no_wait=False):
@classmethod
def show(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -183,7 +184,7 @@ def list_by_subscription(cls, cmd, formatter=lambda x: x):
app_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
request_url = "{}/subscriptions/{}/providers/Microsoft.App/containerApps?api-version={}".format(
management_hostname.strip('/'),
Expand Down Expand Up @@ -211,7 +212,7 @@ def list_by_resource_group(cls, cmd, resource_group_name, formatter=lambda x: x)
app_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -240,7 +241,7 @@ def list_by_resource_group(cls, cmd, resource_group_name, formatter=lambda x: x)
def list_secrets(cls, cmd, resource_group_name, name):

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/listSecrets?api-version={}"
request_url = url_fmt.format(
Expand All @@ -259,7 +260,7 @@ def list_revisions(cls, cmd, resource_group_name, name, formatter=lambda x: x):
revisions_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -288,7 +289,7 @@ def list_revisions(cls, cmd, resource_group_name, name, formatter=lambda x: x):
@classmethod
def show_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -305,7 +306,7 @@ def show_revision(cls, cmd, resource_group_name, container_app_name, name):
@classmethod
def restart_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}/restart?api-version={}"
request_url = url_fmt.format(
Expand All @@ -322,7 +323,7 @@ def restart_revision(cls, cmd, resource_group_name, container_app_name, name):
@classmethod
def activate_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}/activate?api-version={}"
request_url = url_fmt.format(
Expand All @@ -339,7 +340,7 @@ def activate_revision(cls, cmd, resource_group_name, container_app_name, name):
@classmethod
def deactivate_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}/deactivate?api-version={}"
request_url = url_fmt.format(
Expand All @@ -358,7 +359,7 @@ class ManagedEnvironmentClient():
@classmethod
def create(cls, cmd, resource_group_name, name, managed_environment_envelope, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -387,7 +388,7 @@ def create(cls, cmd, resource_group_name, name, managed_environment_envelope, no
@classmethod
def update(cls, cmd, resource_group_name, name, managed_environment_envelope, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -416,7 +417,7 @@ def update(cls, cmd, resource_group_name, name, managed_environment_envelope, no
@classmethod
def delete(cls, cmd, resource_group_name, name, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -451,7 +452,7 @@ def delete(cls, cmd, resource_group_name, name, no_wait=False):
@classmethod
def show(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -469,7 +470,7 @@ def list_by_subscription(cls, cmd, formatter=lambda x: x):
env_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
request_url = "{}/subscriptions/{}/providers/Microsoft.App/managedEnvironments?api-version={}".format(
management_hostname.strip('/'),
Expand Down Expand Up @@ -497,7 +498,7 @@ def list_by_resource_group(cls, cmd, resource_group_name, formatter=lambda x: x)
env_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -527,7 +528,7 @@ class GitHubActionClient():
@classmethod
def create_or_update(cls, cmd, resource_group_name, name, github_action_envelope, headers, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/sourcecontrols/current?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -556,7 +557,7 @@ def create_or_update(cls, cmd, resource_group_name, name, github_action_envelope
@classmethod
def show(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/sourcecontrols/current?api-version={}"
request_url = url_fmt.format(
Expand All @@ -572,7 +573,7 @@ def show(cls, cmd, resource_group_name, name):
@classmethod
def delete(cls, cmd, resource_group_name, name, headers, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/sourcecontrols/current?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -610,7 +611,7 @@ class DaprComponentClient():
def create_or_update(cls, cmd, resource_group_name, environment_name, name, dapr_component_envelope, no_wait=False):

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -641,7 +642,7 @@ def create_or_update(cls, cmd, resource_group_name, environment_name, name, dapr
@classmethod
def delete(cls, cmd, resource_group_name, environment_name, name, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -678,7 +679,7 @@ def delete(cls, cmd, resource_group_name, environment_name, name, no_wait=False)
@classmethod
def show(cls, cmd, resource_group_name, environment_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -697,7 +698,7 @@ def list(cls, cmd, resource_group_name, environment_name, formatter=lambda x: x)
app_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = NEW_API_VERSION
api_version = PREVIEW_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
request_url = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents?api-version={}".format(
management_hostname.strip('/'),
Expand Down
3 changes: 2 additions & 1 deletion src/containerapp/azext_containerapp/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@
GitHubActionConfiguration = {
"registryInfo": None, # [RegistryInfo]
"azureCredentials": None, # [AzureCredentials]
"dockerfilePath": None, # str
"image": None, # str
"contextPath": None, # str
"publishType": None, # str
"os": None, # str
"runtimeStack": None, # str
Expand Down
3 changes: 2 additions & 1 deletion src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ def load_arguments(self, _):
c.argument('registry_url', help='The container registry server, e.g. myregistry.azurecr.io')
c.argument('registry_username', help='The username of the registry. If using Azure Container Registry, we will try to infer the credentials if not supplied')
c.argument('registry_password', help='The password of the registry. If using Azure Container Registry, we will try to infer the credentials if not supplied')
c.argument('docker_file_path', help='The dockerfile location, e.g. ./Dockerfile')
c.argument('context_path', help='Path in the repo from which to run the docker build. Defaults to "./"')
c.argument('service_principal_client_id', help='The service principal client ID. ')
c.argument('service_principal_client_secret', help='The service principal client secret.')
c.argument('service_principal_tenant_id', help='The service principal tenant ID.')
c.argument('image', options_list=['--image', '-i'], help="Container image name that the Github Action should use. Defaults to the Container App name.")

with self.argument_context('containerapp github-action delete') as c:
c.argument('token', help='A Personal Access Token with write access to the specified repository. For more information: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line')
Expand Down
6 changes: 4 additions & 2 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,8 @@ def create_or_update_github_action(cmd,
branch=None,
token=None,
login_with_github=False,
docker_file_path=None,
image=None,
context_path=None,
service_principal_client_id=None,
service_principal_client_secret=None,
service_principal_tenant_id=None):
Expand Down Expand Up @@ -1131,7 +1132,8 @@ def create_or_update_github_action(cmd,
github_action_configuration = GitHubActionConfiguration
github_action_configuration["registryInfo"] = registry_info
github_action_configuration["azureCredentials"] = azure_credentials
github_action_configuration["dockerfilePath"] = docker_file_path
github_action_configuration["contextPath"] = context_path
github_action_configuration["image"] = image

source_control_info["properties"]["githubActionConfiguration"] = github_action_configuration

Expand Down
Loading