salla-gitpuller 1.2.1__tar.gz → 1.2.2__tar.gz
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.
- {salla_gitpuller-1.2.1/salla_gitpuller.egg-info → salla_gitpuller-1.2.2}/PKG-INFO +1 -1
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/gitpuller/__init__.py +1 -1
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/gitpuller/gitpull.py +2 -2
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/gitpuller/slack_notifier.py +23 -2
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/pyproject.toml +1 -1
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2/salla_gitpuller.egg-info}/PKG-INFO +1 -1
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/LICENSE +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/README.md +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/gitpuller/alert_manager.py +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/gitpuller/state_manager.py +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/gitpuller/utils.py +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/SOURCES.txt +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/dependency_links.txt +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/requires.txt +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/top_level.txt +0 -0
- {salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: salla_gitpuller
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables
|
|
5
5
|
Author-email: Mohammed Junaid <safijunaid.ss@gmail.com>, Muhammad Zahid <zahidmuhammad127@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -270,8 +270,8 @@ class GitPullExecutor:
|
|
|
270
270
|
``suppression_hours`` caps how often the *same* error is alerted on,
|
|
271
271
|
avoiding Slack spam when a broken state persists across many runs.
|
|
272
272
|
"""
|
|
273
|
-
# webhook_url is a fallback only;
|
|
274
|
-
# so Mage callers that pass
|
|
273
|
+
# webhook_url is a fallback only; WP_SLACK_DB_ALERTS_TOKEN still wins
|
|
274
|
+
# so Mage callers that pass a webhook stay on the daily thread.
|
|
275
275
|
if webhook_url and not self.slack_notifier.bot_token:
|
|
276
276
|
notifier = SlackNotifier(webhook_url=webhook_url)
|
|
277
277
|
else:
|
|
@@ -10,6 +10,10 @@ import requests
|
|
|
10
10
|
SLACK_POST_MESSAGE_URL = "https://slack.com/api/chat.postMessage"
|
|
11
11
|
SLACK_CONVERSATIONS_HISTORY_URL = "https://slack.com/api/conversations.history"
|
|
12
12
|
DEFAULT_SLACK_CHANNEL = "C05MLHR55JT"
|
|
13
|
+
SLACK_WEBHOOK_MAP_KEY = "db-ops-log"
|
|
14
|
+
|
|
15
|
+
# Unified across every Mage deployment — do not prefix with MAGE_WORKSPACE_NAME.
|
|
16
|
+
# One hash per channel per day; field = gitpuller workspace, value = Slack thread_ts.
|
|
13
17
|
REDIS_THREAD_KEY_PREFIX = "gitpuller:slack_thread"
|
|
14
18
|
REDIS_CREATE_LOCK_TTL_SECONDS = 120
|
|
15
19
|
REDIS_ERROR_MAX_CHARS = 1500
|
|
@@ -27,6 +31,23 @@ def _env(*names: str, default: str = "") -> str:
|
|
|
27
31
|
return default
|
|
28
32
|
|
|
29
33
|
|
|
34
|
+
def _resolve_slack_webhook(explicit: Optional[str] = None) -> Optional[str]:
|
|
35
|
+
"""Prefer an explicit URL, then CDM_SLACK_WEBHOOKS['db-ops-log']."""
|
|
36
|
+
if explicit and str(explicit).strip():
|
|
37
|
+
return str(explicit).strip()
|
|
38
|
+
raw = os.environ.get("CDM_SLACK_WEBHOOKS")
|
|
39
|
+
if raw and str(raw).strip():
|
|
40
|
+
try:
|
|
41
|
+
webhooks = json.loads(str(raw).strip())
|
|
42
|
+
if isinstance(webhooks, dict):
|
|
43
|
+
entry = webhooks.get(SLACK_WEBHOOK_MAP_KEY)
|
|
44
|
+
if entry and str(entry).strip():
|
|
45
|
+
return str(entry).strip()
|
|
46
|
+
except json.JSONDecodeError as exc:
|
|
47
|
+
print(f"⚠️ CDM_SLACK_WEBHOOKS is not valid JSON ({exc})")
|
|
48
|
+
return _env("CDM_SLACK_WEBHOOK_URL") or None
|
|
49
|
+
|
|
50
|
+
|
|
30
51
|
def _get_redis_client():
|
|
31
52
|
"""WP_REDIS_* env vars first, then Mage io_config.yaml, then REDIS_*."""
|
|
32
53
|
global _redis_client, _redis_init_attempted
|
|
@@ -113,13 +134,13 @@ class SlackNotifier:
|
|
|
113
134
|
(channel or os.environ.get("CDM_PROD_DB_SLACK_CHANNEL") or "").strip()
|
|
114
135
|
or DEFAULT_SLACK_CHANNEL
|
|
115
136
|
)
|
|
116
|
-
self.webhook_url = (webhook_url
|
|
137
|
+
self.webhook_url = _resolve_slack_webhook(webhook_url)
|
|
117
138
|
self._thread_ts_cache: Dict[str, str] = {}
|
|
118
139
|
|
|
119
140
|
if not self.bot_token and not self.webhook_url:
|
|
120
141
|
print(
|
|
121
142
|
"⚠️ Slack not configured; skipping alerts "
|
|
122
|
-
"(set WP_SLACK_DB_ALERTS_TOKEN, or
|
|
143
|
+
"(set WP_SLACK_DB_ALERTS_TOKEN, or CDM_SLACK_WEBHOOKS['db-ops-log'])"
|
|
123
144
|
)
|
|
124
145
|
elif not self.bot_token:
|
|
125
146
|
print(
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "salla_gitpuller"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.2"
|
|
8
8
|
description = "A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: salla_gitpuller
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables
|
|
5
5
|
Author-email: Mohammed Junaid <safijunaid.ss@gmail.com>, Muhammad Zahid <zahidmuhammad127@gmail.com>
|
|
6
6
|
License: MIT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{salla_gitpuller-1.2.1 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|