Page MenuHomeDevCentral

D2960.id7547.diff
No OneTemporary

D2960.id7547.diff

diff --git a/_modules/notifications.py b/_modules/notifications.py
--- a/_modules/notifications.py
+++ b/_modules/notifications.py
@@ -26,3 +26,28 @@
built_service["secret"] = __salt__["credentials.get_token"](service["secret"])
return built_service
+
+
+# -------------------------------------------------------------
+# Build triggers
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def get_dockerhub_triggers():
+ prefix = __pillar__.get("notifications_dockerhub_triggers", {}).get("prefix", None)
+ repositories = __pillar__.get("notifications_dockerhub_triggers", {}).get(
+ "repositories", {}
+ )
+
+ return {
+ repository: _get_dockerhub_trigger(key, prefix)
+ for repository, key in repositories.items()
+ }
+
+
+def _get_dockerhub_trigger(key, prefix):
+ secret = __salt__["credentials.read_secret"](key, prefix)
+ 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
@@ -138,6 +138,9 @@
- ops/secrets/nasqueron.notifications.credentials_github_eglide
- ops/secrets/nasqueron.notifications.credentials_phabricator_nasqueron
+ - apps/notifications-center/dockerhub/notifications
+ - apps/notifications-center/dockerhub/authgrove
+
- 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,21 @@
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
+#
+# Each repository is a path to Vault secrets
+#
+# This vault secret should use the following format:
+# source: the UUID after /source/
+# trigger: the UUID after /trigger/
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+notifications_dockerhub_triggers:
+ vault_prefix: apps
+ repositories:
+ nasqueron/auth-grove: notifications-center/dockerhub/auth-grove
+ nasqueron/notifications: 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
@@ -29,6 +29,14 @@
- contents: |
{{ salt['notifications.get_credentials']() | json }}
+/srv/{{ instance }}/storage/app/DockerHubTriggers.json:
+ file.managed:
+ - user: 431
+ - group: 433
+ - 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

Mime Type
text/plain
Expires
Mon, Nov 25, 04:55 (58 m, 49 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2261876
Default Alt Text
D2960.id7547.diff (3 KB)

Event Timeline