Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3763813
D2960.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D2960.diff
View Options
diff --git a/_modules/notifications.py b/_modules/notifications.py
--- a/_modules/notifications.py
+++ b/_modules/notifications.py
@@ -26,3 +26,24 @@
built_service["secret"] = __salt__["credentials.get_token"](service["secret"])
return built_service
+
+
+# -------------------------------------------------------------
+# Build triggers
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def get_dockerhub_triggers():
+ repositories = __pillar__.get("notifications_dockerhub_triggers", {})
+ return {
+ repository: _get_dockerhub_trigger(key)
+ for repository, key in repositories.items()
+ }
+
+
+def _get_dockerhub_trigger(key):
+ secret = __salt__["vault.read_secret"](key)
+ return {
+ "source": secret["source"],
+ "trigger": secret["trigger"],
+ }
diff --git a/pillar/credentials/vault.sls b/pillar/credentials/vault.sls
--- a/pillar/credentials/vault.sls
+++ b/pillar/credentials/vault.sls
@@ -31,6 +31,7 @@
vault_mount_paths:
ops/secrets: ops/data/secrets
ops/privacy: ops/data/privacy
+ apps: apps/data
# -------------------------------------------------------------
# Vault policies to deploy as-is, ie without templating.
@@ -138,6 +139,9 @@
- ops/secrets/nasqueron.notifications.credentials_github_eglide
- ops/secrets/nasqueron.notifications.credentials_phabricator_nasqueron
+ - apps/notifications-center/dockerhub/notifications
+ - apps/notifications-center/dockerhub/auth-grove
+
- ops/secrets/nasqueron.pixelfed.app_key
- ops/secrets/nasqueron.pixelfed.mailgun
- ops/secrets/nasqueron.pixelfed.mysql
diff --git a/pillar/notifications/config.sls b/pillar/notifications/config.sls
--- a/pillar/notifications/config.sls
+++ b/pillar/notifications/config.sls
@@ -42,7 +42,20 @@
instance: https://devcentral.nasqueron.org
secret: nasqueron.notifications.credentials_phabricator_nasqueron
-# Docker Hub build triggers URL can't currently been automated easily.
+# -------------------------------------------------------------
+# Docker Hub build triggers
+#
+# Key: the repository, the same in GitHub and Docker Hub
+# Value: the *full* path to Vault secret
+#
+# This vault secret should use the following format:
+# source: the UUID after /source/
+# trigger: the UUID after /trigger/
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+notifications_dockerhub_triggers:
+ nasqueron/auth-grove: apps/notifications-center/dockerhub/auth-grove
+ nasqueron/notifications: apps/notifications-center/dockerhub/notifications
# -------------------------------------------------------------
# Payload analyzer configuration
diff --git a/roles/paas-docker/containers/notifications.sls b/roles/paas-docker/containers/notifications.sls
--- a/roles/paas-docker/containers/notifications.sls
+++ b/roles/paas-docker/containers/notifications.sls
@@ -30,6 +30,15 @@
- contents: |
{{ salt['notifications.get_credentials']() | json }}
+/srv/{{ instance }}/storage/app/DockerHubTriggers.json:
+ file.managed:
+ - user: 431
+ - group: 433
+ - mode: 400
+ - show_changes: False
+ - contents: |
+ {{ salt['notifications.get_dockerhub_triggers']() | json }}
+
{% for folder, configs in salt['pillar.get']("notifications_configuration", {}).items() %}
{% for config_file, config in configs.items() %}
/srv/{{ instance }}/storage/app/{{ folder }}/{{ config_file }}.json:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 02:41 (17 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2256913
Default Alt Text
D2960.diff (3 KB)
Attached To
Mode
D2960: Configure Docker Hub triggers for Docker Hub
Attached
Detach File
Event Timeline
Log In to Comment