From da9fe3664604e69bc94bf093e3a381818ed2a6d2 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Tue, 30 Mar 2021 19:52:03 +0200 Subject: [PATCH] bundles/pretalx: support installing plugins --- bundles/pretalx/items.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bundles/pretalx/items.py b/bundles/pretalx/items.py index 80d636f..37a7508 100644 --- a/bundles/pretalx/items.py +++ b/bundles/pretalx/items.py @@ -161,3 +161,29 @@ files = { }, }, } + +# run `pip install` one after another due to concurrency issues +last_action = 'action:pretalx_install' +for plugin_name, plugin_config in node.metadata.get('pretalx/plugins', {}).items(): + directories[f'/opt/pretalx/plugin_{plugin_name}'] = {} + + git_deploy[f'/opt/pretalx/plugin_{plugin_name}'] = { + 'repo': plugin_config['repo'], + 'rev': plugin_config.get('rev', 'master'), + 'triggers': { + f'action:pretalx_install_plugin_{plugin_name}', + }, + } + + actions[f'pretalx_install_plugin_{plugin_name}'] = { + 'command': f'cd /opt/pretalx/plugin_{plugin_name} && /opt/pretalx/venv/bin/pip install --upgrade .', + 'needs': { + last_action, + }, + 'triggers': { + 'svc_systemd:pretalx-web:restart', + 'svc_systemd:pretalx-worker:restart', + }, + 'triggered': True, + } + last_action = f'action:pretalx_install_plugin_{plugin_name}'