diff --git a/CHANGELOG.md b/CHANGELOG.md index ff6d1b3cbe..21014de747 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ BUG FIXES: * API health check is also returned by accessing the root path at / ([#2469](https://github.com/microsoft/AzureTRE/pull/2469)) * Temporary disable AppInsight's private endpoint in base workspace ([#2543](https://github.com/microsoft/AzureTRE/pull/2543)) +* Resource Processor execution optimization (`porter show`) for long-standing services ([#2542](https://github.com/microsoft/AzureTRE/pull/2542)) ## 0.4.2 (August 23, 2022) diff --git a/resource_processor/_version.py b/resource_processor/_version.py index 98a433b310..3dd3d2d51b 100644 --- a/resource_processor/_version.py +++ b/resource_processor/_version.py @@ -1 +1 @@ -__version__ = "0.4.5" +__version__ = "0.4.6" diff --git a/resource_processor/resources/commands.py b/resource_processor/resources/commands.py index 482354b508..4bbaf94d0c 100644 --- a/resource_processor/resources/commands.py +++ b/resource_processor/resources/commands.py @@ -71,21 +71,21 @@ async def build_porter_command(config, logger, msg_body, custom_action=False): f" {porter_parameters} --allow-docker-host-access --force" f" --cred ./vmss_porter/arm_auth_local_debugging.json" f" --cred ./vmss_porter/aad_auth.json" - f" && porter show {installation_id}"] + ] return command_line async def build_porter_command_for_outputs(msg_body): installation_id = get_installation_id(msg_body) # we only need "real" outputs and use jq to remove the logs which are big - command_line = [f"porter show {installation_id} --output json | jq -c '. | select(.Outputs!=null) | .Outputs | del (.[] | select(.Name==\"io.cnab.outputs.invocationImageLogs\"))'"] + command_line = [f"porter installations output list --installation {installation_id} --output json | jq -c 'del (.[] | select(.Name==\"io.cnab.outputs.invocationImageLogs\"))'"] return command_line async def get_porter_parameter_keys(config, logger, msg_body): command = [f"{azure_login_command(config)} >/dev/null && \ {azure_acr_login_command(config)} >/dev/null && \ - porter explain --reference {config['registry_server']}/{msg_body['name']}:v{msg_body['version']} -ojson"] + porter explain --reference {config['registry_server']}/{msg_body['name']}:v{msg_body['version']} --output json"] proc = await asyncio.create_subprocess_shell( ''.join(command), diff --git a/resource_processor/vmss_porter/Dockerfile b/resource_processor/vmss_porter/Dockerfile index d2dac8021e..34642782dc 100644 --- a/resource_processor/vmss_porter/Dockerfile +++ b/resource_processor/vmss_porter/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.8-slim-buster SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Install Azure CLI -ARG AZURE_CLI_VERSION=2.37.0-1~buster +ARG AZURE_CLI_VERSION=2.39.0-1~buster COPY scripts/azure-cli.sh /tmp/ RUN export AZURE_CLI_VERSION=${AZURE_CLI_VERSION} \ && /tmp/azure-cli.sh diff --git a/resource_processor/vmss_porter/runner.py b/resource_processor/vmss_porter/runner.py index 2b6c683031..cf5c36b5f2 100644 --- a/resource_processor/vmss_porter/runner.py +++ b/resource_processor/vmss_porter/runner.py @@ -161,7 +161,9 @@ async def invoke_porter_action(msg_body: dict, sb_client: ServiceBusClient, mess # Build and run porter command (flagging if its a built-in action or custom so we can adapt porter command appropriately) is_custom_action = action not in ["install", "upgrade", "uninstall"] porter_command = await build_porter_command(config, message_logger_adapter, msg_body, is_custom_action) + message_logger_adapter.debug("Starting to run porter execution command...") returncode, _, err = await run_porter(porter_command, message_logger_adapter, config) + message_logger_adapter.debug("Finished running porter execution command.") # Handle command output if returncode != 0: @@ -191,7 +193,9 @@ async def get_porter_outputs(msg_body: dict, message_logger_adapter: logging.Log Get outputs JSON from a Porter command """ porter_command = await build_porter_command_for_outputs(msg_body) + message_logger_adapter.debug("Starting to run porter output command...") returncode, stdout, err = await run_porter(porter_command, message_logger_adapter, config) + message_logger_adapter.debug("Finished running porter output command.") if returncode != 0: error_message = "Error context message = " + " ".join(err.split('\n'))