From d3e32cda6c4a55fa33218a864af51ba4c944ddfd Mon Sep 17 00:00:00 2001 From: marrobi Date: Mon, 5 Sep 2022 21:53:09 +0000 Subject: [PATCH 1/6] Fix missing WORKDIR prior to mirroring. --- templates/workspaces/unrestricted/Dockerfile.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/workspaces/unrestricted/Dockerfile.tmpl b/templates/workspaces/unrestricted/Dockerfile.tmpl index 9277111c41..0aa5501ea0 100644 --- a/templates/workspaces/unrestricted/Dockerfile.tmpl +++ b/templates/workspaces/unrestricted/Dockerfile.tmpl @@ -32,6 +32,9 @@ RUN curl -o azuretre.tar.gz -L "https://github.com/microsoft/AzureTRE/archive/r COPY . $BUNDLE_DIR +# Mirror plugins to prevent network access at runtime +# Remove when available from https://github.com/getporter/terraform-mixin/issues/90 +WORKDIR $BUNDLE_DIR/terraform RUN terraform init -backend=false \ && terraform providers mirror /usr/local/share/terraform/plugins From ee4ae3704d92a47c69b23d3628f6db71d7f89616 Mon Sep 17 00:00:00 2001 From: marrobi Date: Mon, 5 Sep 2022 21:55:55 +0000 Subject: [PATCH 2/6] increase version --- templates/workspaces/unrestricted/porter.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workspaces/unrestricted/porter.yaml b/templates/workspaces/unrestricted/porter.yaml index c49685b882..2e5489dc4e 100644 --- a/templates/workspaces/unrestricted/porter.yaml +++ b/templates/workspaces/unrestricted/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-workspace-unrestricted -version: 0.1.7 +version: 0.1.8 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre From 39754c19586d7ef65a9fc2c40e74c2d3cd9c1c41 Mon Sep 17 00:00:00 2001 From: marrobi Date: Mon, 5 Sep 2022 22:33:34 +0000 Subject: [PATCH 3/6] Add templates that create service with external URI. --- .../external_uri/.dockerignore | 7 +++ .../shared_services/external_uri/.gitignore | 2 + .../external_uri/parameters.json | 14 ++++++ .../shared_services/external_uri/porter.yaml | 49 +++++++++++++++++++ .../external_uri/template_schema.json | 18 +++++++ 5 files changed, 90 insertions(+) create mode 100644 templates/shared_services/external_uri/.dockerignore create mode 100644 templates/shared_services/external_uri/.gitignore create mode 100755 templates/shared_services/external_uri/parameters.json create mode 100755 templates/shared_services/external_uri/porter.yaml create mode 100644 templates/shared_services/external_uri/template_schema.json diff --git a/templates/shared_services/external_uri/.dockerignore b/templates/shared_services/external_uri/.dockerignore new file mode 100644 index 0000000000..852f29463e --- /dev/null +++ b/templates/shared_services/external_uri/.dockerignore @@ -0,0 +1,7 @@ +# See https://docs.docker.com/engine/reference/builder/#dockerignore-file +# Put files here that you don't want copied into your bundle's invocation image +.gitignore +**/.terraform/* +**/.terraform.lock.hcl +**/*_backend.tf +Dockerfile.tmpl diff --git a/templates/shared_services/external_uri/.gitignore b/templates/shared_services/external_uri/.gitignore new file mode 100644 index 0000000000..73a68e4976 --- /dev/null +++ b/templates/shared_services/external_uri/.gitignore @@ -0,0 +1,2 @@ +.cnab/ +.terraform* diff --git a/templates/shared_services/external_uri/parameters.json b/templates/shared_services/external_uri/parameters.json new file mode 100755 index 0000000000..d657c0bbce --- /dev/null +++ b/templates/shared_services/external_uri/parameters.json @@ -0,0 +1,14 @@ +{ + "schemaVersion": "1.0.0-DRAFT", + "name": "base", + "created": "2021-06-04T13:37:29.5071039+03:00", + "modified": "2021-06-04T13:37:29.5071039+03:00", + "parameters": [ + { + "name": "connection_uri", + "source": { + "env": "CONNECTION_URI" + } + } + ] +} diff --git a/templates/shared_services/external_uri/porter.yaml b/templates/shared_services/external_uri/porter.yaml new file mode 100755 index 0000000000..9513f255f5 --- /dev/null +++ b/templates/shared_services/external_uri/porter.yaml @@ -0,0 +1,49 @@ +--- +name: tre-shared-service-external-uri +version: 0.0.4 +description: "TRE shared service - External URI" +registry: azuretre + +parameters: + - name: connection_uri + type: string + env: CONNECTION_URI + description: "The connection URI for the Azure TRE shared service" + +outputs: + - name: connection_uri + type: string + applyTo: + - install + - upgrade + +mixins: + - exec + +install: + - exec: + description: "Install shared service" + command: echo + arguments: + - "{{ bundle.parameters.connection_uri }}" + outputs: + - name: connection_uri + regex: "(.*)" + +upgrade: + - exec: + description: "Upgrade shared service" + command: echo + arguments: + - "{{ bundle.parameters.connection_uri }}" + outputs: + - name: connection_uri + regex: "(.*)" + +uninstall: + - exec: + description: "Uninstall shared service" + command: echo + arguments: + - "This shared service does not have anythign to uninstall" + diff --git a/templates/shared_services/external_uri/template_schema.json b/templates/shared_services/external_uri/template_schema.json new file mode 100644 index 0000000000..2599e68dd4 --- /dev/null +++ b/templates/shared_services/external_uri/template_schema.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://github.com/microsoft/AzureTRE/templates/shared_services/certs/template_schema.json", + "type": "object", + "title": "External URI", + "description": "Create a shared service that is solely a link to an external URI", + "required": [ + "connection_uri" + ], + "properties": { + "connection_uri": { + "$id": "#/properties/connection_uri", + "type": "string", + "title": "External URL", + "description": "The external URL for the service" + } + } +} From 6415df79237def4e22ba9535935112fc3d9f6b58 Mon Sep 17 00:00:00 2001 From: marrobi Date: Mon, 5 Sep 2022 22:40:58 +0000 Subject: [PATCH 4/6] fix indentation --- templates/shared_services/external_uri/porter.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/templates/shared_services/external_uri/porter.yaml b/templates/shared_services/external_uri/porter.yaml index 9513f255f5..7724bc9925 100755 --- a/templates/shared_services/external_uri/porter.yaml +++ b/templates/shared_services/external_uri/porter.yaml @@ -27,8 +27,8 @@ install: arguments: - "{{ bundle.parameters.connection_uri }}" outputs: - - name: connection_uri - regex: "(.*)" + - name: connection_uri + regex: "(.*)" upgrade: - exec: @@ -37,8 +37,8 @@ upgrade: arguments: - "{{ bundle.parameters.connection_uri }}" outputs: - - name: connection_uri - regex: "(.*)" + - name: connection_uri + regex: "(.*)" uninstall: - exec: @@ -46,4 +46,3 @@ uninstall: command: echo arguments: - "This shared service does not have anythign to uninstall" - From f36890faf43fcb8252f92e96e667e4ec57a46dbe Mon Sep 17 00:00:00 2001 From: marrobi Date: Fri, 16 Sep 2022 15:37:52 +0000 Subject: [PATCH 5/6] Add changelog, updatable, and enable multiple deployments. --- CHANGELOG.md | 2 +- api_app/_version.py | 2 +- api_app/db/repositories/shared_services.py | 16 ++++++++++------ .../external_uri/template_schema.json | 3 ++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dcb948cec..c833f478b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ BUG FIXES: FEATURES: -* +* Add External URI Shared service template ([#2553](https://github.com/microsoft/AzureTRE/pull/2553)) ENHANCEMENTS: diff --git a/api_app/_version.py b/api_app/_version.py index 86de6bae47..8a64aa006c 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.4.34" +__version__ = "0.4.35" diff --git a/api_app/db/repositories/shared_services.py b/api_app/db/repositories/shared_services.py index 31b71ed966..42717f38ea 100644 --- a/api_app/db/repositories/shared_services.py +++ b/api_app/db/repositories/shared_services.py @@ -60,13 +60,17 @@ def get_shared_service_spec_params(self): def create_shared_service_item(self, shared_service_input: SharedServiceTemplateInCreate) -> Tuple[SharedService, ResourceTemplate]: shared_service_id = str(uuid.uuid4()) - existing_shared_services = self.query(self.operating_shared_service_with_template_name_query(shared_service_input.templateName)) + # for certain shared services, restrict to one instance + multi_instance_allowed = ["tre-shared-service-external-uri"] - # Duplicate is same template (=id), same version and deployed - if existing_shared_services: - if len(existing_shared_services) > 1: - raise InternalError(f"More than one active shared service exists with the same id {shared_service_id}") - raise DuplicateEntity + if shared_service_input.templateName not in multi_instance_allowed: + existing_shared_services = self.query(self.operating_shared_service_with_template_name_query(shared_service_input.templateName)) + + # Duplicate is same template (=id), same version and deployed + if existing_shared_services: + if len(existing_shared_services) > 1: + raise InternalError(f"More than one active shared service exists with the same id {shared_service_id}") + raise DuplicateEntity template = self.validate_input_against_template(shared_service_input.templateName, shared_service_input, ResourceType.SharedService) diff --git a/templates/shared_services/external_uri/template_schema.json b/templates/shared_services/external_uri/template_schema.json index 2599e68dd4..315332fd8d 100644 --- a/templates/shared_services/external_uri/template_schema.json +++ b/templates/shared_services/external_uri/template_schema.json @@ -12,7 +12,8 @@ "$id": "#/properties/connection_uri", "type": "string", "title": "External URL", - "description": "The external URL for the service" + "description": "The external URL for the service", + "updateable": true } } } From 4fa3e3dd5a08204fff1c171eabf3550713bbe80e Mon Sep 17 00:00:00 2001 From: marrobi Date: Wed, 12 Oct 2022 13:47:24 +0000 Subject: [PATCH 6/6] Add doc and changelog. --- CHANGELOG.md | 1 + docs/tre-templates/shared-services/external_uri.md | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 docs/tre-templates/shared-services/external_uri.md diff --git a/CHANGELOG.md b/CHANGELOG.md index eff0e83e9d..ed87c09bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ FEATURES: * Added filtering and sorting to Airlock UI ([#2511](https://github.com/microsoft/AzureTRE/issues/2511)) +* Added External URI shared service ([#2553](https://github.com/microsoft/AzureTRE/pull/2553)) ENHANCEMENTS: diff --git a/docs/tre-templates/shared-services/external_uri.md b/docs/tre-templates/shared-services/external_uri.md new file mode 100644 index 0000000000..09f8d44806 --- /dev/null +++ b/docs/tre-templates/shared-services/external_uri.md @@ -0,0 +1,5 @@ +# External URI Shared Service + +This shared service allows a serivce to be added to the TRE UI that solely links to a pre-existing web asset. Ths could be a link to a data catalog, documentation site, or other system. + +At time of deploy enter the external URI which will be saved as the `connection_uri` of the resulting shared service.