pretalx-gitlab-trigger 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,22 @@
1
+ from django.apps import AppConfig
2
+ from django.utils.translation import gettext_lazy
3
+
4
+ from . import __version__
5
+
6
+
7
+ class PluginApp(AppConfig):
8
+ name = "pretalx_gitlab_trigger"
9
+ verbose_name = "GitLab pipeline trigger"
10
+
11
+ class PretalxPluginMeta:
12
+ name = gettext_lazy("GitLab pipeline trigger")
13
+ author = "Jozef Mlich"
14
+ description = gettext_lazy(
15
+ "Start a GitLab pipeline when the schedule is released, or when slides or PeerTube links change."
16
+ )
17
+ visible = True
18
+ version = __version__
19
+ category = "INTEGRATION"
20
+
21
+ def ready(self):
22
+ from . import signals # noqa: F401, PLC0415
@@ -0,0 +1,59 @@
1
+ import logging
2
+ import urllib.request
3
+ from functools import partial
4
+
5
+ from django.conf import settings
6
+ from django.db import transaction
7
+ from django.db.models.signals import post_delete, post_save
8
+ from django.dispatch import receiver
9
+
10
+ from pretalx.schedule.signals import schedule_release
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ def trigger_pipeline(event):
16
+ if "pretalx_gitlab_trigger" not in event.plugin_list:
17
+ return
18
+ url = settings.PLUGIN_SETTINGS.get("pretalx_gitlab_trigger", {}).get("url")
19
+ if not url:
20
+ return
21
+ request = urllib.request.Request(url, method="POST") # noqa: S310 -- URL comes from pretalx.cfg
22
+ try:
23
+ with urllib.request.urlopen(request, timeout=10) as response: # noqa: S310
24
+ logger.info(
25
+ "GitLab trigger for event %s returned HTTP %s",
26
+ event.slug,
27
+ response.status,
28
+ )
29
+ except OSError:
30
+ # The URL contains the trigger token, so do not log the exception message.
31
+ logger.warning("GitLab trigger failed for event %s", event.slug)
32
+
33
+
34
+ @receiver(schedule_release, dispatch_uid="gitlab_trigger_schedule_release")
35
+ def on_schedule_release(sender, **kwargs):
36
+ trigger_pipeline(sender)
37
+
38
+
39
+ @receiver(
40
+ post_save, sender="submission.Resource", dispatch_uid="gitlab_trigger_resource_save"
41
+ )
42
+ @receiver(
43
+ post_delete,
44
+ sender="submission.Resource",
45
+ dispatch_uid="gitlab_trigger_resource_delete",
46
+ )
47
+ @receiver(
48
+ post_save,
49
+ sender="pretalx_peertube.PeertubeLink",
50
+ dispatch_uid="gitlab_trigger_peertube_save",
51
+ )
52
+ @receiver(
53
+ post_delete,
54
+ sender="pretalx_peertube.PeertubeLink",
55
+ dispatch_uid="gitlab_trigger_peertube_delete",
56
+ )
57
+ def on_talk_data_change(sender, instance, **kwargs):
58
+ # Send after the commit, so the pipeline already downloads the new data.
59
+ transaction.on_commit(partial(trigger_pipeline, instance.submission.event))
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.4
2
+ Name: pretalx-gitlab-trigger
3
+ Version: 1.0.0
4
+ Summary: Start a GitLab pipeline when the schedule, slides or PeerTube links change.
5
+ Author-email: Jozef Mlich <jmlich83@gmail.com>
6
+ Maintainer-email: Jozef Mlich <jmlich83@gmail.com>
7
+ License: Apache Software License
8
+ Project-URL: homepage, https://github.com/jmlich/pretalx-gitlab-trigger
9
+ Project-URL: repository, https://github.com/jmlich/pretalx-gitlab-trigger.git
10
+ Keywords: pretalx
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/x-rst
13
+ License-File: LICENSE
14
+ Provides-Extra: dev
15
+ Requires-Dist: djangofmt; extra == "dev"
16
+ Requires-Dist: pytest; extra == "dev"
17
+ Requires-Dist: pytest-cov; extra == "dev"
18
+ Requires-Dist: pytest-django; extra == "dev"
19
+ Requires-Dist: ruff; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ GitLab pipeline trigger
23
+ =======================
24
+
25
+ This is a plugin for `pretalx`_. It starts a GitLab pipeline when:
26
+
27
+ - the schedule is released,
28
+ - a speaker or organiser adds, changes or deletes a session resource (slides),
29
+ - a PeerTube link from `pretalx-peertube`_ is added, changed or deleted.
30
+
31
+ The pipeline can download the new data from the pretalx API and rebuild a static website.
32
+
33
+ Configuration
34
+ -------------
35
+
36
+ 1. In GitLab, create a pipeline trigger token in **Settings > CI/CD > Pipeline trigger tokens**.
37
+ 2. Add the trigger URL to ``pretalx.cfg``::
38
+
39
+ [plugin:pretalx_gitlab_trigger]
40
+ url = https://gitlab.com/api/v4/projects/PROJECT_ID/ref/BRANCH/trigger/pipeline?token=TRIGGER_TOKEN
41
+
42
+ ``PROJECT_ID`` is the numeric project ID or the URL-encoded path, for example ``OpenAlt%2Fopenalt-cz``.
43
+ 3. Restart pretalx.
44
+ 4. Enable the plugin in the event settings. Only events with the plugin enabled start the pipeline.
45
+
46
+ The plugin sends one POST request per change, after the database commit. A failed request is logged and does not
47
+ stop the change in pretalx.
48
+
49
+ Development
50
+ -----------
51
+
52
+ Run the tests with ``just test``.
53
+
54
+ .. _pretalx: https://github.com/pretalx/pretalx
55
+ .. _pretalx-peertube: https://github.com/jmlich/pretalx-peertube
@@ -0,0 +1,9 @@
1
+ pretalx_gitlab_trigger/__init__.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
2
+ pretalx_gitlab_trigger/apps.py,sha256=g8sBC53lM9Riz5Q1ZDjSeuPtfTBhFv70pPLrKCwVbNI,655
3
+ pretalx_gitlab_trigger/signals.py,sha256=p5tZrnMtzUo9zCQVJa0SxcUY2LRH7NvCF1PK7EkRsNY,1899
4
+ pretalx_gitlab_trigger-1.0.0.dist-info/licenses/LICENSE,sha256=BCwIX1k99tI3WiMwdCk6zNSCGyvV6SJTrBdvuoFwMsM,552
5
+ pretalx_gitlab_trigger-1.0.0.dist-info/METADATA,sha256=3lOY1tEza3i5ioES2k55kR6xqkNsAR2RqZQG0G2UrhA,2028
6
+ pretalx_gitlab_trigger-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
7
+ pretalx_gitlab_trigger-1.0.0.dist-info/entry_points.txt,sha256=67XwTeivtymTHSUBdPuv06tQNAOvV0KaXvA7v2sYVbw,83
8
+ pretalx_gitlab_trigger-1.0.0.dist-info/top_level.txt,sha256=n5g8wbZO0cTjFeT1-t_gMTCjwRZ_VoqhVnJKZP6sY9c,23
9
+ pretalx_gitlab_trigger-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [pretalx.plugin]
2
+ pretalx_gitlab_trigger = pretalx_gitlab_trigger:PretalxPluginMeta
@@ -0,0 +1,13 @@
1
+ Copyright 2026 Jozef Mlich
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1 @@
1
+ pretalx_gitlab_trigger