salla-gitpuller 1.2.0__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.0 → salla_gitpuller-1.2.2}/PKG-INFO +1 -1
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/gitpuller/__init__.py +1 -1
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/gitpuller/gitpull.py +2 -2
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/gitpuller/slack_notifier.py +56 -21
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/pyproject.toml +1 -1
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/PKG-INFO +1 -1
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/LICENSE +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/README.md +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/gitpuller/alert_manager.py +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/gitpuller/state_manager.py +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/gitpuller/utils.py +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/SOURCES.txt +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/dependency_links.txt +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/requires.txt +0 -0
- {salla_gitpuller-1.2.0 → salla_gitpuller-1.2.2}/salla_gitpuller.egg-info/top_level.txt +0 -0
- {salla_gitpuller-1.2.0 → 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,7 @@ 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"
|
|
13
14
|
|
|
14
15
|
# Unified across every Mage deployment — do not prefix with MAGE_WORKSPACE_NAME.
|
|
15
16
|
# One hash per channel per day; field = gitpuller workspace, value = Slack thread_ts.
|
|
@@ -22,8 +23,33 @@ _redis_client = None
|
|
|
22
23
|
_redis_init_attempted = False
|
|
23
24
|
|
|
24
25
|
|
|
26
|
+
def _env(*names: str, default: str = "") -> str:
|
|
27
|
+
for name in names:
|
|
28
|
+
value = (os.environ.get(name) or "").strip()
|
|
29
|
+
if value:
|
|
30
|
+
return value
|
|
31
|
+
return default
|
|
32
|
+
|
|
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
|
+
|
|
25
51
|
def _get_redis_client():
|
|
26
|
-
"""
|
|
52
|
+
"""WP_REDIS_* env vars first, then Mage io_config.yaml, then REDIS_*."""
|
|
27
53
|
global _redis_client, _redis_init_attempted
|
|
28
54
|
if _redis_client is not None:
|
|
29
55
|
return _redis_client
|
|
@@ -37,27 +63,32 @@ def _get_redis_client():
|
|
|
37
63
|
print("⚠️ redis package not installed; Slack thread_ts will not persist across pods")
|
|
38
64
|
return None
|
|
39
65
|
|
|
40
|
-
host =
|
|
41
|
-
password = None
|
|
42
|
-
port = 6379
|
|
43
|
-
try:
|
|
44
|
-
from mage_ai.io.config import ConfigFileLoader
|
|
45
|
-
from mage_ai.settings.repo import get_repo_path
|
|
66
|
+
host = _env("WP_REDIS_HOST")
|
|
67
|
+
password = _env("WP_REDIS_PASSWORD") or None
|
|
68
|
+
port = int(_env("WP_REDIS_PORT") or "6379")
|
|
46
69
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
if not host:
|
|
71
|
+
try:
|
|
72
|
+
from mage_ai.io.config import ConfigFileLoader
|
|
73
|
+
from mage_ai.settings.repo import get_repo_path
|
|
74
|
+
|
|
75
|
+
loader = ConfigFileLoader(os.path.join(get_repo_path(), "io_config.yaml"), "default")
|
|
76
|
+
host = loader["REDIS_HOST"]
|
|
77
|
+
password = loader["REDIS_PASSWORD"] or None
|
|
78
|
+
port = int(loader["REDIS_PORT"])
|
|
79
|
+
except Exception:
|
|
80
|
+
host = None
|
|
53
81
|
|
|
54
82
|
if not host:
|
|
55
|
-
host = (
|
|
56
|
-
password = (
|
|
57
|
-
port = int(
|
|
83
|
+
host = _env("REDIS_HOST") or None
|
|
84
|
+
password = _env("REDIS_PASSWORD") or None
|
|
85
|
+
port = int(_env("REDIS_PORT") or "6379")
|
|
58
86
|
|
|
59
87
|
if not host:
|
|
60
|
-
print(
|
|
88
|
+
print(
|
|
89
|
+
"⚠️ Redis is not configured; Slack thread_ts will not persist across pods "
|
|
90
|
+
"(set WP_REDIS_HOST / WP_REDIS_PORT / WP_REDIS_PASSWORD)"
|
|
91
|
+
)
|
|
61
92
|
return None
|
|
62
93
|
|
|
63
94
|
try:
|
|
@@ -94,22 +125,26 @@ class SlackNotifier:
|
|
|
94
125
|
bot_token: Optional[str] = None,
|
|
95
126
|
channel: Optional[str] = None,
|
|
96
127
|
):
|
|
97
|
-
self.bot_token = (
|
|
128
|
+
self.bot_token = (
|
|
129
|
+
bot_token
|
|
130
|
+
or _env("WP_SLACK_DB_ALERTS_TOKEN", "CDM_PROD_SLACK_BOT_TOKEN")
|
|
131
|
+
or None
|
|
132
|
+
)
|
|
98
133
|
self.channel = (
|
|
99
134
|
(channel or os.environ.get("CDM_PROD_DB_SLACK_CHANNEL") or "").strip()
|
|
100
135
|
or DEFAULT_SLACK_CHANNEL
|
|
101
136
|
)
|
|
102
|
-
self.webhook_url = (webhook_url
|
|
137
|
+
self.webhook_url = _resolve_slack_webhook(webhook_url)
|
|
103
138
|
self._thread_ts_cache: Dict[str, str] = {}
|
|
104
139
|
|
|
105
140
|
if not self.bot_token and not self.webhook_url:
|
|
106
141
|
print(
|
|
107
142
|
"⚠️ Slack not configured; skipping alerts "
|
|
108
|
-
"(set
|
|
143
|
+
"(set WP_SLACK_DB_ALERTS_TOKEN, or CDM_SLACK_WEBHOOKS['db-ops-log'])"
|
|
109
144
|
)
|
|
110
145
|
elif not self.bot_token:
|
|
111
146
|
print(
|
|
112
|
-
"⚠️
|
|
147
|
+
"⚠️ WP_SLACK_DB_ALERTS_TOKEN is not set; using webhook "
|
|
113
148
|
"(alerts will not be threaded)"
|
|
114
149
|
)
|
|
115
150
|
|
|
@@ -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.0 → 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
|