-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into lishakur/1889-tag-gitea
- Loading branch information
Showing
18 changed files
with
283 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
local.settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
bin | ||
obj | ||
csx | ||
.vs | ||
edge | ||
Publish | ||
|
||
*.user | ||
*.suo | ||
*.cscfg | ||
*.Cache | ||
project.lock.json | ||
|
||
/packages | ||
/TestResults | ||
|
||
/tools/NuGet.exe | ||
/App_Data | ||
/secrets | ||
/data | ||
.secrets | ||
appsettings.json | ||
local.settings.json | ||
|
||
node_modules | ||
dist | ||
|
||
# Local python packages | ||
.python_packages/ | ||
|
||
# Python Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Azurite artifacts | ||
__blobstorage__ | ||
__queuestorage__ | ||
__azurite_db*__.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To enable ssh & remote debugging on app service change the base image to the one below | ||
# FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8-appservice | ||
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8 | ||
|
||
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ | ||
AzureFunctionsJobHost__Logging__Console__IsEnabled=true | ||
|
||
COPY requirements.txt / | ||
RUN pip install --no-cache-dir -r /requirements.txt | ||
|
||
COPY . /home/site/wwwroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import logging | ||
|
||
import azure.functions as func | ||
import datetime | ||
|
||
|
||
def main(msg: func.ServiceBusMessage, | ||
outputEvent: func.Out[func.EventGridOutputEvent]): | ||
|
||
logging.info('Python ServiceBus queue trigger processed message: %s', msg.get_body().decode('utf-8')) | ||
outputEvent.set( | ||
func.EventGridOutputEvent( | ||
id="step-result-id", | ||
data={"tag1": "value1", "tag2": "value2"}, | ||
subject="test-subject", | ||
event_type="test-event-1", | ||
event_time=datetime.datetime.utcnow(), | ||
data_version="1.0")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"scriptFile": "__init__.py", | ||
"bindings": [ | ||
{ | ||
"name": "msg", | ||
"type": "serviceBusTrigger", | ||
"direction": "in", | ||
"queueName": "%AIRLOCK_STATUS_CHANGED_QUEUE_NAME%", | ||
"connection": "SB_CONNECTION_STRING" | ||
}, | ||
{ | ||
"type": "eventGrid", | ||
"name": "outputEvent", | ||
"topicEndpointUri": "EVENT_GRID_TOPIC_URI_SETTING", | ||
"topicKeySetting": "EVENT_GRID_TOPIC_KEY_SETTING", | ||
"direction": "out" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"version": "2.0", | ||
"logging": { | ||
"applicationInsights": { | ||
"samplingSettings": { | ||
"isEnabled": true, | ||
"excludedTypes": "Request" | ||
} | ||
} | ||
}, | ||
"extensionBundle": { | ||
"id": "Microsoft.Azure.Functions.ExtensionBundle", | ||
"version": "[3.3.0, 4.0.0)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Do not include azure-functions-worker as it may conflict with the Azure Functions platform | ||
|
||
azure-functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
data "local_file" "airlock_processor_version" { | ||
filename = "${path.root}/../../../airlock_processor/_version.py" | ||
} | ||
|
||
locals { | ||
version = replace(replace(replace(data.local_file.airlock_processor_version.content, "__version__ = \"", ""), "\"", ""), "\n", "") | ||
} | ||
|
||
# re-using the web api app plan | ||
data "azurerm_app_service_plan" "core" { | ||
name = "plan-${var.tre_id}" | ||
resource_group_name = var.resource_group_name | ||
} | ||
|
||
data "azurerm_application_insights" "core" { | ||
name = "appi-${var.tre_id}" | ||
resource_group_name = var.resource_group_name | ||
} | ||
|
||
|
||
resource "azurerm_storage_account" "sa_airlock_processor_func_app" { | ||
name = local.airlock_function_sa_name | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
account_tier = "Standard" | ||
account_replication_type = "LRS" | ||
tags = local.tre_core_tags | ||
|
||
lifecycle { ignore_changes = [tags] } | ||
} | ||
|
||
resource "azurerm_linux_function_app" "airlock_function_app" { | ||
name = local.airlock_function_app_name | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
|
||
storage_account_name = azurerm_storage_account.sa_airlock_processor_func_app.name | ||
service_plan_id = data.azurerm_app_service_plan.core.id | ||
|
||
storage_account_access_key = azurerm_storage_account.sa_airlock_processor_func_app.primary_access_key | ||
tags = local.tre_core_tags | ||
|
||
identity { | ||
type = "UserAssigned" | ||
identity_ids = [azurerm_user_assigned_identity.airlock_id.id] | ||
} | ||
|
||
app_settings = { | ||
"SB_CONNECTION_STRING" = data.azurerm_servicebus_namespace.airlock_sb.default_primary_connection_string | ||
"EVENT_GRID_TOPIC_URI_SETTING" = azurerm_eventgrid_topic.step_result.endpoint | ||
"EVENT_GRID_TOPIC_KEY_SETTING" = azurerm_eventgrid_topic.step_result.primary_access_key | ||
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = false | ||
"AIRLOCK_STATUS_CHANGED_QUEUE_NAME" = "airlock-status-changed" | ||
"APPINSIGHTS_INSTRUMENTATIONKEY" = data.azurerm_application_insights.core.instrumentation_key | ||
} | ||
|
||
site_config { | ||
always_on = var.enable_local_debugging ? true : false | ||
container_registry_managed_identity_client_id = azurerm_user_assigned_identity.airlock_id.client_id | ||
container_registry_use_managed_identity = true | ||
application_stack { | ||
docker { | ||
registry_url = var.docker_registry_server | ||
image_name = var.airlock_processor_image_repository | ||
image_tag = local.version | ||
} | ||
} | ||
} | ||
|
||
lifecycle { ignore_changes = [tags] } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
data "azurerm_cosmosdb_account" "tre-db-account" { | ||
name = "cosmos-${var.tre_id}" | ||
resource_group_name = var.resource_group_name | ||
} | ||
|
||
data "azurerm_container_registry" "mgmt_acr" { | ||
name = var.mgmt_acr_name | ||
resource_group_name = var.mgmt_resource_group_name | ||
} | ||
|
||
resource "azurerm_user_assigned_identity" "airlock_id" { | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
tags = local.tre_core_tags | ||
|
||
name = "id-airlock-${var.tre_id}" | ||
|
||
lifecycle { ignore_changes = [tags] } | ||
} | ||
|
||
resource "azurerm_role_assignment" "acrpull_role" { | ||
scope = data.azurerm_container_registry.mgmt_acr.id | ||
role_definition_name = "AcrPull" | ||
principal_id = azurerm_user_assigned_identity.airlock_id.principal_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "servicebus_sender" { | ||
scope = data.azurerm_servicebus_namespace.airlock_sb.id | ||
role_definition_name = "Azure Service Bus Data Sender" | ||
principal_id = azurerm_user_assigned_identity.airlock_id.principal_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "servicebus_receiver" { | ||
scope = data.azurerm_servicebus_namespace.airlock_sb.id | ||
role_definition_name = "Azure Service Bus Data Receiver" | ||
principal_id = azurerm_user_assigned_identity.airlock_id.principal_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "cosmos_contributor" { | ||
scope = data.azurerm_cosmosdb_account.tre-db-account.id | ||
role_definition_name = "Contributor" | ||
principal_id = azurerm_user_assigned_identity.airlock_id.principal_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters