salla-gitpuller 0.1.0__tar.gz → 0.1.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-0.1.2/PKG-INFO +33 -0
- salla_gitpuller-0.1.2/README.md +22 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/gitpuller/gitpull.py +51 -4
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/pyproject.toml +1 -1
- salla_gitpuller-0.1.2/salla_gitpuller.egg-info/PKG-INFO +33 -0
- salla_gitpuller-0.1.0/PKG-INFO +0 -12
- salla_gitpuller-0.1.0/README.md +0 -1
- salla_gitpuller-0.1.0/salla_gitpuller.egg-info/PKG-INFO +0 -12
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/LICENSE +0 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/gitpuller/__init__.py +0 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/gitpuller/utils.py +0 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/salla_gitpuller.egg-info/SOURCES.txt +0 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/salla_gitpuller.egg-info/dependency_links.txt +0 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/salla_gitpuller.egg-info/top_level.txt +0 -0
- {salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/setup.cfg +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: salla_gitpuller
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables
|
|
5
|
+
Author-email: Muhammad Zahid <zahidmuhammad127@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Zahid07/gitpuller
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# gitpuller
|
|
13
|
+
|
|
14
|
+
This is how to use this
|
|
15
|
+
|
|
16
|
+
from gitpuller import git_pull, transform_custom
|
|
17
|
+
|
|
18
|
+
repo_path, base_path = transform_custom()
|
|
19
|
+
result = git_pull(repo_path, "workspace1", "git@github.com:youruser/yourrepo.git", "1234")
|
|
20
|
+
print(result)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## New Build
|
|
24
|
+
|
|
25
|
+
Clean up the orignal build
|
|
26
|
+
|
|
27
|
+
rm -rf build dist *.egg-info
|
|
28
|
+
|
|
29
|
+
Make a new build
|
|
30
|
+
|
|
31
|
+
python -m build
|
|
32
|
+
|
|
33
|
+
Then Upload to PyPi and dont forget to change the version in pyproject.toml
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# gitpuller
|
|
2
|
+
|
|
3
|
+
This is how to use this
|
|
4
|
+
|
|
5
|
+
from gitpuller import git_pull, transform_custom
|
|
6
|
+
|
|
7
|
+
repo_path, base_path = transform_custom()
|
|
8
|
+
result = git_pull(repo_path, "workspace1", "git@github.com:youruser/yourrepo.git", "1234")
|
|
9
|
+
print(result)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## New Build
|
|
13
|
+
|
|
14
|
+
Clean up the orignal build
|
|
15
|
+
|
|
16
|
+
rm -rf build dist *.egg-info
|
|
17
|
+
|
|
18
|
+
Make a new build
|
|
19
|
+
|
|
20
|
+
python -m build
|
|
21
|
+
|
|
22
|
+
Then Upload to PyPi and dont forget to change the version in pyproject.toml
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import requests
|
|
2
3
|
import subprocess
|
|
3
4
|
from typing import Any, Dict
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
def git_pull(repo_path: str, workspace_name: str, git_url: str, key_material: str) -> Dict[str, Any]:
|
|
7
|
+
def git_pull(repo_path: str, workspace_name: str, git_url: str, key_material: str, webhook_url: str) -> Dict[str, Any]:
|
|
7
8
|
"""
|
|
8
9
|
Executes 'git pull' in the specified repository path using a deploy key
|
|
9
10
|
provided via the env var WP_AUTOPULL_SSHKEY.
|
|
@@ -18,6 +19,38 @@ def git_pull(repo_path: str, workspace_name: str, git_url: str, key_material: st
|
|
|
18
19
|
print(f"Running git pull for workspace: {workspace_name}")
|
|
19
20
|
print(f"Repo path: {repo_path}")
|
|
20
21
|
|
|
22
|
+
repo_name = git_url.split('/')[-1].replace('.git', '')
|
|
23
|
+
|
|
24
|
+
if not all([webhook_url]):
|
|
25
|
+
raise EnvironmentError(
|
|
26
|
+
"One or more Slack environment variables are missing:\n"
|
|
27
|
+
"CDM_SLACK_WEBHOOK_URL"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
payload = {
|
|
31
|
+
"text": f"Automate Git Pull Pipeline Failed",
|
|
32
|
+
"blocks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "header",
|
|
35
|
+
"text": {
|
|
36
|
+
"type": "plain_text",
|
|
37
|
+
"text": f":alert: Automate Git Pull Pipeline Failed :alert:"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "divider"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"type": "section",
|
|
45
|
+
"text": {
|
|
46
|
+
"type": "mrkdwn",
|
|
47
|
+
"text": f"*Repository:* `{repo_name}`"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
21
54
|
if not os.path.exists(repo_path):
|
|
22
55
|
raise FileNotFoundError(f"Repo path does not exist: {repo_path}")
|
|
23
56
|
|
|
@@ -25,11 +58,20 @@ def git_pull(repo_path: str, workspace_name: str, git_url: str, key_material: st
|
|
|
25
58
|
if not key_material:
|
|
26
59
|
raise EnvironmentError(f"Missing SSH key material for workspace: {workspace_name}")
|
|
27
60
|
|
|
28
|
-
if
|
|
29
|
-
|
|
61
|
+
if key_material:
|
|
62
|
+
# Remove any quotes that might be wrapping the key
|
|
63
|
+
key_material = key_material.strip().strip('"').strip("'")
|
|
64
|
+
|
|
65
|
+
# Handle literal \n sequences
|
|
66
|
+
if "\\n" in key_material:
|
|
67
|
+
key_material = key_material.replace("\\n", "\n")
|
|
68
|
+
|
|
69
|
+
# Ensure proper line endings
|
|
70
|
+
if not key_material.endswith("\n"):
|
|
71
|
+
key_material += "\n"
|
|
30
72
|
|
|
31
73
|
ssh_dir = os.path.expanduser("~/.ssh")
|
|
32
|
-
key_path = os.path.join(ssh_dir, "
|
|
74
|
+
key_path = os.path.join(ssh_dir, "SallaApp_mageai_CI_CD_deploy")
|
|
33
75
|
os.makedirs(ssh_dir, exist_ok=True)
|
|
34
76
|
os.chmod(ssh_dir, 0o700)
|
|
35
77
|
|
|
@@ -54,6 +96,11 @@ def git_pull(repo_path: str, workspace_name: str, git_url: str, key_material: st
|
|
|
54
96
|
except subprocess.CalledProcessError as e:
|
|
55
97
|
git_output = (e.stdout or "") + (e.stderr or "")
|
|
56
98
|
git_status = "error"
|
|
99
|
+
payload["blocks"].append({
|
|
100
|
+
"type": "section",
|
|
101
|
+
"text": {"type": "mrkdwn", "text": f"*Error Output:*\n```{git_output[:1500]}```"} # truncate for Slack limit
|
|
102
|
+
})
|
|
103
|
+
requests.post(webhook_url, json=payload)
|
|
57
104
|
finally:
|
|
58
105
|
try:
|
|
59
106
|
os.remove(key_path)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "salla_gitpuller"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.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 = [
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: salla_gitpuller
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables
|
|
5
|
+
Author-email: Muhammad Zahid <zahidmuhammad127@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Zahid07/gitpuller
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# gitpuller
|
|
13
|
+
|
|
14
|
+
This is how to use this
|
|
15
|
+
|
|
16
|
+
from gitpuller import git_pull, transform_custom
|
|
17
|
+
|
|
18
|
+
repo_path, base_path = transform_custom()
|
|
19
|
+
result = git_pull(repo_path, "workspace1", "git@github.com:youruser/yourrepo.git", "1234")
|
|
20
|
+
print(result)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## New Build
|
|
24
|
+
|
|
25
|
+
Clean up the orignal build
|
|
26
|
+
|
|
27
|
+
rm -rf build dist *.egg-info
|
|
28
|
+
|
|
29
|
+
Make a new build
|
|
30
|
+
|
|
31
|
+
python -m build
|
|
32
|
+
|
|
33
|
+
Then Upload to PyPi and dont forget to change the version in pyproject.toml
|
salla_gitpuller-0.1.0/PKG-INFO
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: salla_gitpuller
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables
|
|
5
|
-
Author-email: Muhammad Zahid <zahidmuhammad127@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/Zahid07/gitpuller
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Dynamic: license-file
|
|
11
|
-
|
|
12
|
-
# gitpuller
|
salla_gitpuller-0.1.0/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# gitpuller
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: salla_gitpuller
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: A lightweight utility to git pull a repository using SSH deploy keys stored in environment variables
|
|
5
|
-
Author-email: Muhammad Zahid <zahidmuhammad127@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/Zahid07/gitpuller
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Dynamic: license-file
|
|
11
|
-
|
|
12
|
-
# gitpuller
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{salla_gitpuller-0.1.0 → salla_gitpuller-0.1.2}/salla_gitpuller.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|