From be5c66e7a7327e7f1083055d751bb0774516322a Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Wed, 29 Jan 2025 14:25:37 +0000 Subject: [PATCH 01/12] Fix dev container build failure on mount config Fixes #4271 Add an `initializeCommand` to create necessary directories before the build. * Add `initializeCommand` in `devcontainer/devcontainer.json` to create `$HOME/.azure` and `$HOME/.config` directories if they do not exist. * Ensure the command runs before the container is created to prevent build failures due to missing directories. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/AzureTRE/issues/4271?shareId=XXXX-XXXX-XXXX-XXXX). --- devcontainer/devcontainer.json | 296 +++++++++++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 devcontainer/devcontainer.json diff --git a/devcontainer/devcontainer.json b/devcontainer/devcontainer.json new file mode 100644 index 0000000000..e9aaf3607b --- /dev/null +++ b/devcontainer/devcontainer.json @@ -0,0 +1,296 @@ +{ + "name": "AzureTRE", + // Uncomment when debugging using Jetbrains + // "features": { + // "ghcr.io/devcontainers/features/sshd:1": { + // "version": "latest" + // } + // }, + "build": { + "context": "..", + "dockerfile": "Dockerfile", + "args": { + // To ensure that the group ID for the docker group in the container + // matches the group ID on the host, add this to your .bash_profile on the host + // export DOCKER_GROUP_ID=$(getent group docker | awk -F ":" '{ print $3 }') + "DOCKER_GROUP_ID": "${localEnv:DOCKER_GROUP_ID}", + "INTERACTIVE": "true" + } + }, + "runArgs": [ + "--network", + "host" + ], + "mounts": [ + // Keep command history + "type=volume,source=tre-bashhistory,target=/home/vscode/commandhistory", + // Mounts the login details from the host machine to azcli works in the container + "type=bind,source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure", + // Mount docker socket for docker builds + "type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock", + // Mounts the github cli login details from the host machine to the container (~/.config/gh/hosts.yml) + "type=bind,source=${env:HOME}${env:USERPROFILE}/.config,target=/home/vscode/.config" + ], + "remoteUser": "vscode", + "containerEnv": { + "DOCKER_BUILDKIT": "1" + }, + "remoteEnv": { + // this is used for SuperLinter + "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" + }, + "customizations": { + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.defaultProfile.linux": "bash", + "python.pythonPath": "/usr/local/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.formatting.provider": "black", + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": [ + "--ignore=e2e_tests", + "-W ignore::DeprecationWarning" + ], + "python.testing.cwd": "${workspaceFolder}", + "files.associations": { + "*.terraform": "terraform" + }, + "launch": { + "configurations": [ + { + "name": "TRE API", + "type": "python", + "module": "uvicorn", + "request": "launch", + "args": [ + "main:app", + "--reload", + "--host", + "::", + "--port", + "8000" + ], + "jinja": true, + "justMyCode": false, + "console": "integratedTerminal", + "preLaunchTask": "Copy_env_file_for_api_debug", + "cwd": "${workspaceFolder}/api_app", + "envFile": "${workspaceFolder}/api_app/.env", + "env": { + "OTEL_RESOURCE_ATTRIBUTES": "service.name=api,service.instance.id=local_debug,service.version=dev" + } + }, + { + "name": "E2E Extended", + "type": "python", + "request": "launch", + "module": "pytest", + "justMyCode": true, + "cwd": "${workspaceFolder}/e2e_tests/", + "preLaunchTask": "Copy_env_file_for_e2e_debug", + "args": [ + "-m", + "extended", + "--verify", + "false" + ] + }, + { + "name": "E2E Extended AAD", + "type": "python", + "request": "launch", + "module": "pytest", + "justMyCode": true, + "cwd": "${workspaceFolder}/e2e_tests/", + "preLaunchTask": "Copy_env_file_for_e2e_debug", + "args": [ + "-m", + "extended_aad", + "--verify", + "false" + ] + }, + { + "name": "E2E Shared Services", + "type": "python", + "request": "launch", + "module": "pytest", + "justMyCode": true, + "cwd": "${workspaceFolder}/e2e_tests/", + "preLaunchTask": "Copy_env_file_for_e2e_debug", + "args": [ + "-m", + "shared_services", + "--verify", + "false" + ] + }, + { + "name": "E2E Performance", + "type": "python", + "request": "launch", + "module": "pytest", + "justMyCode": true, + "cwd": "${workspaceFolder}/e2e_tests/", + "preLaunchTask": "Copy_env_file_for_e2e_debug", + "args": [ + "-m", + "performance", + "--verify", + "false" + ] + }, + { + "name": "E2E Smoke", + "type": "python", + "request": "launch", + "module": "pytest", + "justMyCode": true, + "cwd": "${workspaceFolder}/e2e_tests/", + "preLaunchTask": "Copy_env_file_for_e2e_debug", + "args": [ + "-m", + "smoke", + "--verify", + "false" + ] + }, + { + "name": "E2E Airlock", + "type": "python", + "request": "launch", + "module": "pytest", + "justMyCode": true, + "cwd": "${workspaceFolder}/e2e_tests/", + "preLaunchTask": "Copy_env_file_for_e2e_debug", + "args": [ + "-m", + "airlock", + "--verify", + "false" + ] + }, + { + "name": "Resource Processor", + "type": "python", + "request": "launch", + "program": "vmss_porter/runner.py", + "console": "integratedTerminal", + "preLaunchTask": "Install_resource_processor_dependencies", + "cwd": "${workspaceFolder}/resource_processor", + "envFile": "${workspaceFolder}/core/private.env", + "env": { + "PYTHONPATH": ".", + "OTEL_RESOURCE_ATTRIBUTES": "service.name=resource_processor,service.instance.id=local_debug,service.version=dev" + }, + "justMyCode": false + }, + { + "name": "Debug Python file", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "purpose": [ + "debug-test" + ] + }, + { + "name": "Launch Edge (localhost)", + "type": "pwa-msedge", + "request": "launch", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/ui/app" + }, + { + "name": "Launch Chrome (localhost)", + "type": "pwa-chrome", + "request": "launch", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/ui/app" + } + ], + "compounds": [] + }, + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "label": "Copy_env_file_for_api_debug", + "command": "./.devcontainer/scripts/consolidate_env.sh ${workspaceFolder} ${workspaceFolder}/api_app/.env", + "type": "shell" + }, + { + "label": "Copy_env_file_for_e2e_debug", + "command": "./.devcontainer/scripts/consolidate_env.sh ${workspaceFolder} ${workspaceFolder}/e2e_tests/.env", + "type": "shell" + }, + { + "label": "Install_resource_processor_dependencies", + "command": "pip install -r ./resource_processor/vmss_porter/requirements.txt", + "type": "shell" + }, + { + "label": "Unit_tests", + "group": { + "kind": "test", + "isDefault": true + }, + "command": "pytest", + "args": [ + "--ignore=e2e_tests" + ] + }, + { + "label": "Smoke_tests", + "group": "test", + "command": "python", + "options": { + "cwd": "${workspaceFolder}/e2e_tests/" + }, + "args": [ + "-m", + "pytest", + "-m", + "smoke" + ] + } + ] + } + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-python.pylance", + "hashicorp.terraform", + "github.vscode-pull-request-github", + "getporter.porter-vscode", + "davidanson.vscode-markdownlint", + "editorconfig.editorconfig", + "mikestead.dotenv", + "humao.rest-client", + "timonwong.shellcheck", + "ms-azuretools.vscode-azurefunctions" + ] + } + }, + "forwardPorts": [ + 8000 + ], + // Run commands after the container is created. + "postCreateCommand": "./.devcontainer/scripts/post-create.sh", + "initializeCommand": "mkdir -p $HOME/.azure $HOME/.config || true" +} From 6778389d6a4033e8add009302e1ee7d1dc88909b Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 15:19:41 +0000 Subject: [PATCH 02/12] fixup e2e tests --- e2e_tests/config.py | 8 +++----- e2e_tests/pytest.ini | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/e2e_tests/config.py b/e2e_tests/config.py index cd43a78181..31ccb34c37 100644 --- a/e2e_tests/config.py +++ b/e2e_tests/config.py @@ -1,11 +1,9 @@ +import warnings from starlette.config import Config +warnings.filterwarnings("ignore", message="Config file '.env' not found.") -try: - config = Config('.env') -# Workaround needed until FastAPI uses Starlette >= 3.7.1 -except FileNotFoundError: - config = Config() +config = Config('.env') # Resource Info RESOURCE_LOCATION: str = config("RESOURCE_LOCATION", default="") diff --git a/e2e_tests/pytest.ini b/e2e_tests/pytest.ini index 72fe2d3414..3e3cf490e3 100644 --- a/e2e_tests/pytest.ini +++ b/e2e_tests/pytest.ini @@ -10,6 +10,7 @@ markers = workspace_services asyncio_mode = auto +asyncio_default_fixture_loop_scope = session log_cli = 1 log_cli_level = INFO From fa278349fa897a88bfb298cd58ae85a9ff1e22fb Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 16:30:38 +0000 Subject: [PATCH 03/12] Add default event loop scope --- e2e_tests/conftest.py | 8 -------- e2e_tests/pytest.ini | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/e2e_tests/conftest.py b/e2e_tests/conftest.py index 7195a14588..9ae0a20fda 100644 --- a/e2e_tests/conftest.py +++ b/e2e_tests/conftest.py @@ -19,14 +19,6 @@ def pytest_addoption(parser): parser.addoption("--verify", action="store", default="true") -@pytest.fixture(scope="session") -def event_loop(): - try: - loop = asyncio.get_running_loop() - except RuntimeError: - loop = asyncio.new_event_loop() - yield loop - loop.close() @pytest.fixture(scope="session") diff --git a/e2e_tests/pytest.ini b/e2e_tests/pytest.ini index 3e3cf490e3..db463a9680 100644 --- a/e2e_tests/pytest.ini +++ b/e2e_tests/pytest.ini @@ -11,6 +11,7 @@ markers = asyncio_mode = auto asyncio_default_fixture_loop_scope = session +asyncio_default_test_loop_scope = session log_cli = 1 log_cli_level = INFO From 404424724a7551eb063a56bf90b04557b81b2f8e Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 16:40:56 +0000 Subject: [PATCH 04/12] Fix linting --- e2e_tests/conftest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/e2e_tests/conftest.py b/e2e_tests/conftest.py index 9ae0a20fda..fb7fadbb9e 100644 --- a/e2e_tests/conftest.py +++ b/e2e_tests/conftest.py @@ -19,8 +19,6 @@ def pytest_addoption(parser): parser.addoption("--verify", action="store", default="true") - - @pytest.fixture(scope="session") def verify(pytestconfig): if pytestconfig.getoption("verify").lower() == "true": From d784d1aceaf6c49d0429c62663c2e60403f8acba Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 16:52:38 +0000 Subject: [PATCH 05/12] Update pytest-asyncio version --- api_app/requirements-dev.txt | 2 +- e2e_tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api_app/requirements-dev.txt b/api_app/requirements-dev.txt index 824dd2c0f8..a251c5a507 100644 --- a/api_app/requirements-dev.txt +++ b/api_app/requirements-dev.txt @@ -1,5 +1,5 @@ # Dev requirements -pytest-asyncio==0.24.0 +pytest-asyncio==0.25.3 httpx==0.25.0 mock==5.1.0 pytest==8.3.3 diff --git a/e2e_tests/requirements.txt b/e2e_tests/requirements.txt index 9e16ce1bc8..89ca82a654 100644 --- a/e2e_tests/requirements.txt +++ b/e2e_tests/requirements.txt @@ -1,7 +1,7 @@ # API httpx==0.25.0 pytest==8.3.3 -pytest-asyncio==0.24.0 +pytest-asyncio==0.25.3 starlette==0.41.2 pytest-timeout==2.2.0 pytest-xdist==3.3.1 From 60cb8db0af90e184b4cc30065a8dde7bb9060f15 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 16:53:39 +0000 Subject: [PATCH 06/12] update version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 8815fb52f3..8b8252f484 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.20.3" +__version__ = "0.20.4" From f483b767d4031033a9e0838de426bb54eb8d7814 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 17:18:07 +0000 Subject: [PATCH 07/12] Move to inline scope --- api_app/_version.py | 2 +- api_app/requirements-dev.txt | 2 +- e2e_tests/conftest.py | 2 +- e2e_tests/requirements.txt | 2 +- e2e_tests/test_airlock.py | 2 +- e2e_tests/test_performance.py | 2 +- e2e_tests/test_provisioned_health_api.py | 2 +- e2e_tests/test_ui.py | 2 +- e2e_tests/test_workspace_service_templates.py | 2 +- e2e_tests/test_workspace_services.py | 2 +- e2e_tests/test_workspace_templates.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api_app/_version.py b/api_app/_version.py index 8b8252f484..8815fb52f3 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.20.4" +__version__ = "0.20.3" diff --git a/api_app/requirements-dev.txt b/api_app/requirements-dev.txt index a251c5a507..824dd2c0f8 100644 --- a/api_app/requirements-dev.txt +++ b/api_app/requirements-dev.txt @@ -1,5 +1,5 @@ # Dev requirements -pytest-asyncio==0.25.3 +pytest-asyncio==0.24.0 httpx==0.25.0 mock==5.1.0 pytest==8.3.3 diff --git a/e2e_tests/conftest.py b/e2e_tests/conftest.py index fb7fadbb9e..39589e1696 100644 --- a/e2e_tests/conftest.py +++ b/e2e_tests/conftest.py @@ -12,7 +12,7 @@ LOGGER = logging.getLogger(__name__) -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") def pytest_addoption(parser): diff --git a/e2e_tests/requirements.txt b/e2e_tests/requirements.txt index 89ca82a654..9e16ce1bc8 100644 --- a/e2e_tests/requirements.txt +++ b/e2e_tests/requirements.txt @@ -1,7 +1,7 @@ # API httpx==0.25.0 pytest==8.3.3 -pytest-asyncio==0.25.3 +pytest-asyncio==0.24.0 starlette==0.41.2 pytest-timeout==2.2.0 pytest-xdist==3.3.1 diff --git a/e2e_tests/test_airlock.py b/e2e_tests/test_airlock.py index 43e2df71bb..051a5c9d81 100644 --- a/e2e_tests/test_airlock.py +++ b/e2e_tests/test_airlock.py @@ -14,7 +14,7 @@ from helpers import get_admin_token -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") LOGGER = logging.getLogger(__name__) BLOB_FILE_PATH = "./test_airlock_sample.txt" BLOB_NAME = os.path.basename(BLOB_FILE_PATH) diff --git a/e2e_tests/test_performance.py b/e2e_tests/test_performance.py index 6c6d836d9d..f6e7637fe2 100644 --- a/e2e_tests/test_performance.py +++ b/e2e_tests/test_performance.py @@ -8,7 +8,7 @@ from helpers import get_admin_token -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") @pytest.mark.performance diff --git a/e2e_tests/test_provisioned_health_api.py b/e2e_tests/test_provisioned_health_api.py index 01c3cbeecc..92636d12dc 100644 --- a/e2e_tests/test_provisioned_health_api.py +++ b/e2e_tests/test_provisioned_health_api.py @@ -5,7 +5,7 @@ from resources import strings -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") @pytest.mark.smoke diff --git a/e2e_tests/test_ui.py b/e2e_tests/test_ui.py index 6e34da518b..8d71827fdb 100644 --- a/e2e_tests/test_ui.py +++ b/e2e_tests/test_ui.py @@ -4,7 +4,7 @@ import config -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") @pytest.mark.smoke diff --git a/e2e_tests/test_workspace_service_templates.py b/e2e_tests/test_workspace_service_templates.py index 34545d9af1..8ea70e6368 100644 --- a/e2e_tests/test_workspace_service_templates.py +++ b/e2e_tests/test_workspace_service_templates.py @@ -8,7 +8,7 @@ from resources import strings from helpers import get_admin_token -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") workspace_service_templates = [ (strings.AZUREML_SERVICE), diff --git a/e2e_tests/test_workspace_services.py b/e2e_tests/test_workspace_services.py index cd48910817..3013fef370 100644 --- a/e2e_tests/test_workspace_services.py +++ b/e2e_tests/test_workspace_services.py @@ -5,7 +5,7 @@ from resources.resource import get_resource, post_resource from resources import strings -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") workspace_services = [ strings.AZUREML_SERVICE, diff --git a/e2e_tests/test_workspace_templates.py b/e2e_tests/test_workspace_templates.py index d0ccb1f64e..1fed11daaa 100644 --- a/e2e_tests/test_workspace_templates.py +++ b/e2e_tests/test_workspace_templates.py @@ -11,7 +11,7 @@ from helpers import get_admin_token -pytestmark = pytest.mark.asyncio +pytestmark = pytest.mark.asyncio(loop_scope="session") workspace_templates = [ From 2cdcdb96b6aba21d6de5db8520ca48821edab1c6 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 17:41:22 +0000 Subject: [PATCH 08/12] remvoe config not released --- e2e_tests/pytest.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e_tests/pytest.ini b/e2e_tests/pytest.ini index db463a9680..3e3cf490e3 100644 --- a/e2e_tests/pytest.ini +++ b/e2e_tests/pytest.ini @@ -11,7 +11,6 @@ markers = asyncio_mode = auto asyncio_default_fixture_loop_scope = session -asyncio_default_test_loop_scope = session log_cli = 1 log_cli_level = INFO From 326077ff93e31038467c792d07bcb7bae49a31eb Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 18:33:20 +0000 Subject: [PATCH 09/12] Enable P0v3 as worksapce app service sku. --- templates/workspaces/airlock-import-review/template_schema.json | 1 + templates/workspaces/base/template_schema.json | 1 + templates/workspaces/unrestricted/template_schema.json | 1 + 3 files changed, 3 insertions(+) diff --git a/templates/workspaces/airlock-import-review/template_schema.json b/templates/workspaces/airlock-import-review/template_schema.json index e05a0d87e7..180e360abc 100644 --- a/templates/workspaces/airlock-import-review/template_schema.json +++ b/templates/workspaces/airlock-import-review/template_schema.json @@ -16,6 +16,7 @@ "description": "The SKU that will be used when deploying an Azure App Service Plan.", "default": "P1v3", "enum": [ + "P0v3", "P1v3", "P1v2", "S1" diff --git a/templates/workspaces/base/template_schema.json b/templates/workspaces/base/template_schema.json index 77049d7f1c..b456b5f044 100644 --- a/templates/workspaces/base/template_schema.json +++ b/templates/workspaces/base/template_schema.json @@ -28,6 +28,7 @@ "description": "The SKU that will be used when deploying an Azure App Service Plan.", "default": "P1v3", "enum": [ + "P0v3", "P1v3", "P1v2", "S1" diff --git a/templates/workspaces/unrestricted/template_schema.json b/templates/workspaces/unrestricted/template_schema.json index 3fbaa16a3a..f9c8a807f1 100644 --- a/templates/workspaces/unrestricted/template_schema.json +++ b/templates/workspaces/unrestricted/template_schema.json @@ -28,6 +28,7 @@ "description": "The SKU that will be used when deploying an Azure App Service Plan.", "default": "P1v3", "enum": [ + "P0v3", "P1v3", "P1v2", "S1" From e1102885350dce3d4bc4f39f4f52f085d726b103 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 19:01:07 +0000 Subject: [PATCH 10/12] Update bundle versions --- templates/workspaces/airlock-import-review/porter.yaml | 2 +- templates/workspaces/base/porter.yaml | 2 +- templates/workspaces/unrestricted/porter.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/workspaces/airlock-import-review/porter.yaml b/templates/workspaces/airlock-import-review/porter.yaml index 7e4330cd30..56f90dbc70 100644 --- a/templates/workspaces/airlock-import-review/porter.yaml +++ b/templates/workspaces/airlock-import-review/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-airlock-import-review -version: 0.14.1 +version: 0.14.2 description: "A workspace to do Airlock Data Import Reviews for Azure TRE" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index 89be17e3de..a7e09fa692 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-base -version: 1.9.1 +version: 1.9.2 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/unrestricted/porter.yaml b/templates/workspaces/unrestricted/porter.yaml index 5d1cc8cfa1..b8bd2becae 100644 --- a/templates/workspaces/unrestricted/porter.yaml +++ b/templates/workspaces/unrestricted/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-unrestricted -version: 0.13.1 +version: 0.13.2 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre From b39193d1c54d78eb1a79ab6cba5442474b325a94 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 20:26:21 +0000 Subject: [PATCH 11/12] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 929f97efc4..742774fdf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ BUG FIXES: * Fix VM actions where Workspace shared storage doesn't allow shared key access ([#4222](https://github.com/microsoft/AzureTRE/issues/4222)) * Fix public exposure in Guacamole service ([[#4199](https://github.com/microsoft/AzureTRE/issues/4199)]) * Fix Azure ML network tags to use name rather than ID ([[#4151](https://github.com/microsoft/AzureTRE/issues/4151)]) +* Fix dev container build failure on missing mount directories and CI fixes ([#4290](https://github.com/microsoft/AzureTRE/pull/4290)) COMPONENTS: From 4687809c3aff2190cab37ca1637fef281a96ed37 Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 4 Feb 2025 21:47:25 +0000 Subject: [PATCH 12/12] fix devcontainer location --- .devcontainer/devcontainer.json | 7 +- CHANGELOG.md | 2 +- devcontainer/devcontainer.json | 296 -------------------------------- 3 files changed, 6 insertions(+), 299 deletions(-) delete mode 100644 devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9d49130458..8d4eefdebf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,7 +29,7 @@ // Mount docker socket for docker builds "type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock", // Mounts the github cli login details from the host machine to the container (~/.config/gh/hosts.yml) - "type=bind,source=${env:HOME}${env:USERPROFILE}/.config,target=/home/vscode/.config", + "type=bind,source=${env:HOME}${env:USERPROFILE}/.config,target=/home/vscode/.config" ], "remoteUser": "vscode", "containerEnv": { @@ -277,6 +277,8 @@ "ms-python.pylance", "hashicorp.terraform", "github.vscode-pull-request-github", + "gitHub.copilot", + "github.copilot-chat", "getporter.porter-vscode", "davidanson.vscode-markdownlint", "editorconfig.editorconfig", @@ -291,5 +293,6 @@ 8000 ], // Run commands after the container is created. - "postCreateCommand": "./.devcontainer/scripts/post-create.sh" + "postCreateCommand": "./.devcontainer/scripts/post-create.sh", + "initializeCommand": "mkdir -p $HOME/.azure $HOME/.config || true" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 742774fdf1..1f5501078f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,7 @@ BUG FIXES: * Fix VM actions where Workspace shared storage doesn't allow shared key access ([#4222](https://github.com/microsoft/AzureTRE/issues/4222)) * Fix public exposure in Guacamole service ([[#4199](https://github.com/microsoft/AzureTRE/issues/4199)]) * Fix Azure ML network tags to use name rather than ID ([[#4151](https://github.com/microsoft/AzureTRE/issues/4151)]) -* Fix dev container build failure on missing mount directories and CI fixes ([#4290](https://github.com/microsoft/AzureTRE/pull/4290)) +* Fix dev container build failure on missing mount directories, add copilot extensions, and CI fixes ([#4290](https://github.com/microsoft/AzureTRE/pull/4290)) COMPONENTS: diff --git a/devcontainer/devcontainer.json b/devcontainer/devcontainer.json deleted file mode 100644 index e9aaf3607b..0000000000 --- a/devcontainer/devcontainer.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "name": "AzureTRE", - // Uncomment when debugging using Jetbrains - // "features": { - // "ghcr.io/devcontainers/features/sshd:1": { - // "version": "latest" - // } - // }, - "build": { - "context": "..", - "dockerfile": "Dockerfile", - "args": { - // To ensure that the group ID for the docker group in the container - // matches the group ID on the host, add this to your .bash_profile on the host - // export DOCKER_GROUP_ID=$(getent group docker | awk -F ":" '{ print $3 }') - "DOCKER_GROUP_ID": "${localEnv:DOCKER_GROUP_ID}", - "INTERACTIVE": "true" - } - }, - "runArgs": [ - "--network", - "host" - ], - "mounts": [ - // Keep command history - "type=volume,source=tre-bashhistory,target=/home/vscode/commandhistory", - // Mounts the login details from the host machine to azcli works in the container - "type=bind,source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure", - // Mount docker socket for docker builds - "type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock", - // Mounts the github cli login details from the host machine to the container (~/.config/gh/hosts.yml) - "type=bind,source=${env:HOME}${env:USERPROFILE}/.config,target=/home/vscode/.config" - ], - "remoteUser": "vscode", - "containerEnv": { - "DOCKER_BUILDKIT": "1" - }, - "remoteEnv": { - // this is used for SuperLinter - "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" - }, - "customizations": { - "vscode": { - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.defaultProfile.linux": "bash", - "python.pythonPath": "/usr/local/bin/python", - "python.linting.enabled": true, - "python.linting.pylintEnabled": false, - "python.linting.flake8Enabled": true, - "python.formatting.provider": "black", - "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", - "python.formatting.blackPath": "/usr/local/py-utils/bin/black", - "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", - "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", - "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", - "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", - "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", - "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", - "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "python.testing.pytestArgs": [ - "--ignore=e2e_tests", - "-W ignore::DeprecationWarning" - ], - "python.testing.cwd": "${workspaceFolder}", - "files.associations": { - "*.terraform": "terraform" - }, - "launch": { - "configurations": [ - { - "name": "TRE API", - "type": "python", - "module": "uvicorn", - "request": "launch", - "args": [ - "main:app", - "--reload", - "--host", - "::", - "--port", - "8000" - ], - "jinja": true, - "justMyCode": false, - "console": "integratedTerminal", - "preLaunchTask": "Copy_env_file_for_api_debug", - "cwd": "${workspaceFolder}/api_app", - "envFile": "${workspaceFolder}/api_app/.env", - "env": { - "OTEL_RESOURCE_ATTRIBUTES": "service.name=api,service.instance.id=local_debug,service.version=dev" - } - }, - { - "name": "E2E Extended", - "type": "python", - "request": "launch", - "module": "pytest", - "justMyCode": true, - "cwd": "${workspaceFolder}/e2e_tests/", - "preLaunchTask": "Copy_env_file_for_e2e_debug", - "args": [ - "-m", - "extended", - "--verify", - "false" - ] - }, - { - "name": "E2E Extended AAD", - "type": "python", - "request": "launch", - "module": "pytest", - "justMyCode": true, - "cwd": "${workspaceFolder}/e2e_tests/", - "preLaunchTask": "Copy_env_file_for_e2e_debug", - "args": [ - "-m", - "extended_aad", - "--verify", - "false" - ] - }, - { - "name": "E2E Shared Services", - "type": "python", - "request": "launch", - "module": "pytest", - "justMyCode": true, - "cwd": "${workspaceFolder}/e2e_tests/", - "preLaunchTask": "Copy_env_file_for_e2e_debug", - "args": [ - "-m", - "shared_services", - "--verify", - "false" - ] - }, - { - "name": "E2E Performance", - "type": "python", - "request": "launch", - "module": "pytest", - "justMyCode": true, - "cwd": "${workspaceFolder}/e2e_tests/", - "preLaunchTask": "Copy_env_file_for_e2e_debug", - "args": [ - "-m", - "performance", - "--verify", - "false" - ] - }, - { - "name": "E2E Smoke", - "type": "python", - "request": "launch", - "module": "pytest", - "justMyCode": true, - "cwd": "${workspaceFolder}/e2e_tests/", - "preLaunchTask": "Copy_env_file_for_e2e_debug", - "args": [ - "-m", - "smoke", - "--verify", - "false" - ] - }, - { - "name": "E2E Airlock", - "type": "python", - "request": "launch", - "module": "pytest", - "justMyCode": true, - "cwd": "${workspaceFolder}/e2e_tests/", - "preLaunchTask": "Copy_env_file_for_e2e_debug", - "args": [ - "-m", - "airlock", - "--verify", - "false" - ] - }, - { - "name": "Resource Processor", - "type": "python", - "request": "launch", - "program": "vmss_porter/runner.py", - "console": "integratedTerminal", - "preLaunchTask": "Install_resource_processor_dependencies", - "cwd": "${workspaceFolder}/resource_processor", - "envFile": "${workspaceFolder}/core/private.env", - "env": { - "PYTHONPATH": ".", - "OTEL_RESOURCE_ATTRIBUTES": "service.name=resource_processor,service.instance.id=local_debug,service.version=dev" - }, - "justMyCode": false - }, - { - "name": "Debug Python file", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal", - "purpose": [ - "debug-test" - ] - }, - { - "name": "Launch Edge (localhost)", - "type": "pwa-msedge", - "request": "launch", - "url": "http://localhost:3000", - "webRoot": "${workspaceFolder}/ui/app" - }, - { - "name": "Launch Chrome (localhost)", - "type": "pwa-chrome", - "request": "launch", - "url": "http://localhost:3000", - "webRoot": "${workspaceFolder}/ui/app" - } - ], - "compounds": [] - }, - "tasks": { - "version": "2.0.0", - "tasks": [ - { - "label": "Copy_env_file_for_api_debug", - "command": "./.devcontainer/scripts/consolidate_env.sh ${workspaceFolder} ${workspaceFolder}/api_app/.env", - "type": "shell" - }, - { - "label": "Copy_env_file_for_e2e_debug", - "command": "./.devcontainer/scripts/consolidate_env.sh ${workspaceFolder} ${workspaceFolder}/e2e_tests/.env", - "type": "shell" - }, - { - "label": "Install_resource_processor_dependencies", - "command": "pip install -r ./resource_processor/vmss_porter/requirements.txt", - "type": "shell" - }, - { - "label": "Unit_tests", - "group": { - "kind": "test", - "isDefault": true - }, - "command": "pytest", - "args": [ - "--ignore=e2e_tests" - ] - }, - { - "label": "Smoke_tests", - "group": "test", - "command": "python", - "options": { - "cwd": "${workspaceFolder}/e2e_tests/" - }, - "args": [ - "-m", - "pytest", - "-m", - "smoke" - ] - } - ] - } - }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-python.python", - "ms-python.pylance", - "hashicorp.terraform", - "github.vscode-pull-request-github", - "getporter.porter-vscode", - "davidanson.vscode-markdownlint", - "editorconfig.editorconfig", - "mikestead.dotenv", - "humao.rest-client", - "timonwong.shellcheck", - "ms-azuretools.vscode-azurefunctions" - ] - } - }, - "forwardPorts": [ - 8000 - ], - // Run commands after the container is created. - "postCreateCommand": "./.devcontainer/scripts/post-create.sh", - "initializeCommand": "mkdir -p $HOME/.azure $HOME/.config || true" -}