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

Airlock notifier update #4042

Merged
merged 23 commits into from
Aug 15, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ENHANCEMENTS:
* Add Case Study Docs ([#1366](https://github.com/microsoft/AzureTRE/issues/1366))
* Ability to host TRE on a custom domain ([#4014](https://github.com/microsoft/AzureTRE/pull/4014))
* Remove AppServiceFileAuditLogs diagnostic setting ([#4033](https://github.com/microsoft/AzureTRE/issues/4033))
* Update to the Airlock Notifier Shared Service ([#3909](https://github.com/microsoft/AzureTRE/issues/3909))

BUG FIXES:
* Removed 429 Error (Costs API) form presenting in UI ([#3929](https://github.com/microsoft/AzureTRE/issues/3929))
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ terraform-deploy:
&& . ${MAKEFILE_DIR}/devops/scripts/load_env.sh ${DIR}/.env \
&& cd ${DIR}/terraform/ && ./deploy.sh

terraform-upgrade:
$(call target_title, "Upgrading ${DIR} with Terraform") \
&& . ${MAKEFILE_DIR}/devops/scripts/check_dependencies.sh env \
&& . ${MAKEFILE_DIR}/devops/scripts/load_and_validate_env.sh \
&& . ${MAKEFILE_DIR}/devops/scripts/load_env.sh ${DIR}/.env \
&& cd ${DIR}/terraform/ && ./upgrade.sh

terraform-import:
$(call target_title, "Importing ${DIR} with Terraform") \
&& . ${MAKEFILE_DIR}/devops/scripts/check_dependencies.sh env \
Expand Down
1 change: 1 addition & 0 deletions core/terraform/network/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ resource "azurerm_subnet" "airlock_notification" {
actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
}
}
service_endpoints = ["Microsoft.ServiceBus"]
}

resource "azurerm_subnet" "airlock_storage" {
Expand Down
4 changes: 4 additions & 0 deletions core/terraform/network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ output "resource_processor_subnet_id" {
value = azurerm_subnet.resource_processor.id
}

output "airlock_notification_subnet_id" {
value = azurerm_subnet.airlock_notification.id
}

# DNS Zones

output "azure_monitor_dns_zone_id" {
Expand Down
4 changes: 4 additions & 0 deletions core/terraform/servicebus.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ resource "azurerm_servicebus_namespace" "sb" {
subnet_id = module.network.airlock_events_subnet_id
ignore_missing_vnet_service_endpoint = false
}
network_rules {
subnet_id = module.network.airlock_notification_subnet_id
ignore_missing_vnet_service_endpoint = false
}
}

lifecycle { ignore_changes = [tags] }
Expand Down
2 changes: 1 addition & 1 deletion core/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.10.5"
__version__ = "0.10.6"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_creator_variable": {
"inputs": {
"variables": [
{
"name": "creator",
"type": "string",
"value": "@{body('Parse_JSON')?['data']?['request']?['created_by']?['name']}"
}
]
},
"runAfter": {
"Initialize_workspace_variable": [
"SUCCEEDED"
]
},
"type": "InitializeVariable"
},
"Initialize_message_variable": {
"inputs": {
"variables": [
Expand All @@ -27,9 +44,26 @@
}
]
},
"runAfter": {
"Initialize_creator_variable": [
"SUCCEEDED"
]
},
"type": "InitializeVariable"
},
"Initialize_workspace_variable": {
"inputs": {
"variables": [
{
"name": "workspace",
"type": "string",
"value": "@body('Parse_JSON')?['data']?['workspace']?['display_name']"
}
]
},
"runAfter": {
"Initialize_message_variable": [
"Succeeded"
"SUCCEEDED"
]
},
"type": "InitializeVariable"
Expand All @@ -44,98 +78,98 @@
"event_type": {
"type": "string"
},
"recipient_emails_by_role": {
"properties": {
"airlock_manager": {
"items": {
"type": "string"
},
"type": "array"
},
"workspace_owner": {
"items": {
"type": "string"
},
"type": "array"
},
"workspace_researcher": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"request": {
"type": "object",
"properties": {
"id": {
"business_justification": {
"type": "string"
},
"createdWhen": {
"type": "number"
},
"createdBy": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"updatedWhen": {
"type": "number"
},
"updatedBy": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"name": {
"type": "string"
}
}
},
"type": "object"
},
"requestType": {
"type": "string"
"createdWhen": {
"type": "number"
},
"files": {
"type": "array",
"items": {
"name": {
"type": "string"
},
"size": {
"type": "number"
}
}
},
"type": "array"
},
"status": {
"id": {
"type": "string"
},
"business_justification": {
"requestType": {
"type": "string"
},
"status": {
"type": "string"
},
"updatedBy": {
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
},
"updatedWhen": {
"type": "number"
}
}
},
"type": "object"
},
"workspace": {
"type": "object",
"properties": {
"id": {
"description": {
"type": "string"
},
"display_name": {
"type": "string"
},
"description": {
"id": {
"type": "string"
}
}
},
"recipient_emails_by_role": {
"type": "object",
"properties": {
"workspace_researcher": {
"type": "array",
"items": {
"type": "string"
}
},
"workspace_owner": {
"type": "array",
"items": {
"type": "string"
}
},
"airlock_manager": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"type": "object"
}
},
"type": "object"
Expand All @@ -150,10 +184,11 @@
"Send_Email_with_SMTP": {
"inputs": {
"parameters": {
"body": "<a href=\"@{parameters('tre_url')}/workspaces/@{body('Parse_JSON')?['data']?['workspace']?['id']}/requests/@{body('Parse_JSON')?['data']?['request']?['id']}\">View the request</a>",
"body": "<!doctype html><html><head> <meta name=viewport content=\"width=device-width,initial-scale=1\"> <meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"> <title>@{variables('message')}</title> <style>body{background-color:#f6f6f6;font-family:sans-serif;-webkit-font-smoothing:antialiased;font-size:14px;line-height:1.4;margin:0;padding:0;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}table{border-collapse:separate;mso-table-lspace:0pt;mso-table-rspace:0pt;width:100%}table td{font-family:sans-serif;font-size:14px;vertical-align:top}.body{background-color:#f6f6f6;width:100%}.container{display:block;margin:0 auto!important;max-width:580px;padding:10px;width:580px}.content{box-sizing:border-box;display:block;margin:0 auto;max-width:580px;padding:10px}.main{background:#fff;border-radius:3px;width:100%}.wrapper{box-sizing:border-box;padding:20px}.content-block{padding-bottom:10px;padding-top:10px}.footer{clear:both;margin-top:10px;text-align:center;width:100%}.footer a,.footer p,.footer span,.footer td{color:#999;font-size:12px;text-align:center}h1,h2,h3,h4{color:#000;font-family:sans-serif;font-weight:400;line-height:1.4;margin:0;margin-bottom:30px}h1{font-size:35px;font-weight:300;text-align:center;text-transform:capitalize}ol,p,ul{font-family:sans-serif;font-size:14px;font-weight:400;margin:0;margin-bottom:15px}ol li,p li,ul li{list-style-position:inside;margin-left:5px}a{color:#3498db;text-decoration:underline}.btn{box-sizing:border-box;width:100%}.btn>tbody>tr>td{padding-bottom:15px}.btn table{width:auto}.btn table td{background-color:#fff;border-radius:5px;text-align:center}.btn a{background-color:#fff;border:solid 1px #3498db;border-radius:5px;box-sizing:border-box;color:#3498db;cursor:pointer;display:inline-block;font-size:14px;font-weight:700;margin:0;padding:12px 25px;text-decoration:none;text-transform:capitalize}.btn-primary table td{background-color:#3498db}.btn-primary a{background-color:#3498db;border-color:#3498db;color:#fff}.last{margin-bottom:0}.first{margin-top:0}.align-center{text-align:center}.align-right{text-align:right}.align-left{text-align:left}.clear{clear:both}.mt0{margin-top:0}.mb0{margin-bottom:0}.preheader{color:transparent;display:none;height:0;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;visibility:hidden;width:0}hr{border:0;border-bottom:1px solid #f6f6f6;margin:20px 0}@media only screen and (max-width:620px){table.body h1{font-size:28px!important;margin-bottom:10px!important}table.body a,table.body ol,table.body p,table.body span,table.body td,table.body ul{font-size:16px!important}table.body .article,table.body .wrapper{padding:10px!important}table.body .content{padding:0!important}table.body .container{padding:0!important;width:100%!important}table.body .main{border-left-width:0!important;border-radius:0!important;border-right-width:0!important}table.body .btn table{width:100%!important}table.body .btn a{width:100%!important}table.body .img-responsive{height:auto!important;max-width:100%!important;width:auto!important}}@media all{.ExternalClass{width:100%}.ExternalClass,.ExternalClass div,.ExternalClass font,.ExternalClass p,.ExternalClass span,.ExternalClass td{line-height:100%}.apple-link a{color:inherit!important;font-family:inherit!important;font-size:inherit!important;font-weight:inherit!important;line-height:inherit!important;text-decoration:none!important}#MessageViewBody a{color:inherit;text-decoration:none;font-size:inherit;font-family:inherit;font-weight:inherit;line-height:inherit}.btn-primary table td:hover{background-color:#34495e!important}.btn-primary a:hover{background-color:#34495e!important;border-color:#34495e!important}}</style></head><body><span class=preheader>@{variables('message')}</span> <table role=presentation border=0 cellpadding=0 cellspacing=0 class=body> <tr> <td>&nbsp;</td> <td class=container> <div class=content> <table role=presentation class=main> <tr> <td class=wrapper> <table role=presentation border=0 cellpadding=0 cellspacing=0> <tr> <td> <h1>Azure TRE</h1> <p>@{variables('message')}</p> <table role=presentation border=0 cellpadding=0 cellspacing=0 class=\"btn btn-primary\"> <tbody> <tr> <td align=center> <table role=presentation border=0 cellpadding=0 cellspacing=0> <tbody> <tr> <td> <a class=btn href=\"@{parameters('tre_url')}/workspaces/@{body('Parse_JSON')?['data']?['workspace']?['id']}/requests/@{body('Parse_JSON')?['data']?['request']?['id']}\" target=_blank>View the request</a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </table> </td> </tr> </table> <div class=footer> <table role=presentation border=0 cellpadding=0 cellspacing=0> </table> </div> </div> </td> <td>&nbsp;</td> </tr> </table></body></html>",
"from": "@parameters('smtp_from_email')",
"importance": "Normal",
"subject": "@variables('message')",
"isHTML": true,
"subject": "@replace(replace(variables('message'), '<b>', ''), '</b>', '')",
"to": "@{join(variables('recipients'), ';')}"
},
"serviceProviderConfiguration": {
Expand Down Expand Up @@ -187,7 +222,7 @@
"Set_approved_message": {
"inputs": {
"name": "message",
"value": "Your Airlock request was approved"
"value": "Your Airlock request in <b>@{variables('workspace')}</b> workspace was approved"
},
"runAfter": {
"Set_recipients_as_researchers_emails": [
Expand All @@ -201,7 +236,6 @@
"name": "recipients",
"value": "@body('Parse_JSON')?['data']?['recipient_emails_by_role']?['workspace_researcher']"
},
"runAfter": {},
"type": "SetVariable"
}
},
Expand All @@ -212,7 +246,7 @@
"Set_in_review_message": {
"inputs": {
"name": "message",
"value": "An Airlock request needs your review"
"value": "An Airlock request in <b>@{variables('workspace')}</b> workspace by <b>@{variables('creator')}</b> needs your review"
},
"runAfter": {
"Set_recipients_as_owners_emails": [
Expand All @@ -226,7 +260,6 @@
"name": "recipients",
"value": "@body('Parse_JSON')?['data']?['recipient_emails_by_role']?['airlock_manager']"
},
"runAfter": {},
"type": "SetVariable"
}
},
Expand All @@ -239,7 +272,6 @@
"inputs": {
"runStatus": "Cancelled"
},
"runAfter": {},
"type": "Terminate"
}
}
Expand Down
24 changes: 7 additions & 17 deletions templates/shared_services/airlock_notifier/app/connections.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"serviceProviderConnections": {
"serviceBus": {
"displayName": "core-service-bus",
"parameterSetName": "ManagedServiceIdentity",
"parameterValues": {
"connectionString": "@appsetting('serviceBus_connectionString')"
"authProvider": {
"Type": "ManagedServiceIdentity"
},
"fullyQualifiedNamespace": "@appsetting('serviceBus_fullyQualifiedNamespace')"
},
"serviceProvider": {
"id": "/serviceProviders/serviceBus"
},
"displayName": "core-service-bus"
}
},
"Smtp": {
"displayName": "smtp",
Expand All @@ -22,19 +26,5 @@
"id": "/serviceProviders/Smtp"
}
}
},
"managedApiConnections": {
"smtp": {
"api": {
"id": "/subscriptions/@appsetting('subscription')/providers/Microsoft.Web/locations/westeurope/managedApis/smtp"
},
"connection": {
"id": "/subscriptions/@appsetting('subscription')/resourceGroups/@appsetting('resource_group')/providers/Microsoft.Web/connections/smtp"
},
"authentication": {
"type": "ManagedServiceIdentity"
},
"connectionRuntimeUrl": "@appsetting('smtp_connection_runtime_url')"
}
}
}
2 changes: 1 addition & 1 deletion templates/shared_services/airlock_notifier/app/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"version": "[1.*, 2.0.0)"
"version": "[4.0.0, 5.0.0)"
}
}
Loading
Loading