superset-showtime 0.5.9__py3-none-any.whl → 0.5.11__py3-none-any.whl
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.
Potentially problematic release.
This version of superset-showtime might be problematic. Click here for more details.
- showtime/__init__.py +1 -1
- showtime/core/git_validation.py +90 -16
- {superset_showtime-0.5.9.dist-info → superset_showtime-0.5.11.dist-info}/METADATA +1 -1
- {superset_showtime-0.5.9.dist-info → superset_showtime-0.5.11.dist-info}/RECORD +6 -6
- {superset_showtime-0.5.9.dist-info → superset_showtime-0.5.11.dist-info}/WHEEL +0 -0
- {superset_showtime-0.5.9.dist-info → superset_showtime-0.5.11.dist-info}/entry_points.txt +0 -0
showtime/__init__.py
CHANGED
showtime/core/git_validation.py
CHANGED
|
@@ -16,7 +16,8 @@ except ImportError:
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
# Hard-coded required SHA - update this when needed
|
|
19
|
-
|
|
19
|
+
# https://github.com/apache/superset/commit/47414e18d4c2980d0cc4718b3e704845f7dfd356
|
|
20
|
+
REQUIRED_SHA = "47414e18d4c2980d0cc4718b3e704845f7dfd356"
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class GitValidationError(Exception):
|
|
@@ -49,6 +50,7 @@ def is_git_repository(path: str = ".") -> bool:
|
|
|
49
50
|
def validate_required_sha(required_sha: Optional[str] = None) -> Tuple[bool, Optional[str]]:
|
|
50
51
|
"""
|
|
51
52
|
Validate that the required SHA exists in the current Git repository.
|
|
53
|
+
Uses GitHub API for reliable validation in shallow clone environments.
|
|
52
54
|
|
|
53
55
|
Args:
|
|
54
56
|
required_sha: SHA to validate (default: REQUIRED_SHA constant)
|
|
@@ -58,33 +60,105 @@ def validate_required_sha(required_sha: Optional[str] = None) -> Tuple[bool, Opt
|
|
|
58
60
|
- (True, None) if validation passes
|
|
59
61
|
- (False, error_message) if validation fails
|
|
60
62
|
"""
|
|
61
|
-
if Repo is None:
|
|
62
|
-
return False, "GitPython not available for SHA validation"
|
|
63
|
-
|
|
64
63
|
sha_to_check = required_sha or REQUIRED_SHA
|
|
65
64
|
if not sha_to_check:
|
|
66
65
|
return True, None # No requirement set
|
|
67
66
|
|
|
67
|
+
# Try GitHub API validation first (works in shallow clones)
|
|
68
|
+
try:
|
|
69
|
+
return _validate_sha_via_github_api(sha_to_check)
|
|
70
|
+
except Exception as e:
|
|
71
|
+
print(f"⚠️ GitHub API validation failed: {e}")
|
|
72
|
+
|
|
73
|
+
# Fallback to Git validation for non-GitHub origins
|
|
74
|
+
if Repo is None:
|
|
75
|
+
print("⚠️ GitPython not available, skipping SHA validation")
|
|
76
|
+
return True, None
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
repo = Repo(".")
|
|
80
|
+
is_valid, error = _validate_sha_in_log(repo, sha_to_check)
|
|
81
|
+
if is_valid:
|
|
82
|
+
return True, None
|
|
83
|
+
else:
|
|
84
|
+
print(f"⚠️ Git validation failed: {error}")
|
|
85
|
+
return True, None # Allow operation to continue
|
|
86
|
+
|
|
87
|
+
except InvalidGitRepositoryError:
|
|
88
|
+
print("⚠️ Not a Git repository, skipping SHA validation")
|
|
89
|
+
return True, None
|
|
90
|
+
except Exception as e:
|
|
91
|
+
print(f"⚠️ Git validation error: {e}")
|
|
92
|
+
return True, None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _validate_sha_via_github_api(required_sha: str) -> Tuple[bool, Optional[str]]:
|
|
96
|
+
"""Validate SHA using GitHub API - works reliably in shallow clones"""
|
|
68
97
|
try:
|
|
98
|
+
import httpx
|
|
99
|
+
from git import Repo
|
|
100
|
+
|
|
101
|
+
from .github import GitHubInterface
|
|
102
|
+
|
|
103
|
+
# Get current SHA from Git
|
|
69
104
|
repo = Repo(".")
|
|
105
|
+
current_sha = repo.head.commit.hexsha
|
|
106
|
+
|
|
107
|
+
# Use existing GitHubInterface (handles all the setup/token detection)
|
|
108
|
+
github = GitHubInterface()
|
|
109
|
+
|
|
110
|
+
# 1. Check if required SHA exists
|
|
111
|
+
commit_url = f"{github.base_url}/repos/{github.org}/{github.repo}/commits/{required_sha}"
|
|
112
|
+
|
|
113
|
+
with httpx.Client() as client:
|
|
114
|
+
response = client.get(commit_url, headers=github.headers)
|
|
115
|
+
if response.status_code == 404:
|
|
116
|
+
return False, f"Required SHA {required_sha[:7]} not found in repository"
|
|
117
|
+
response.raise_for_status()
|
|
118
|
+
|
|
119
|
+
# 2. Compare SHAs to verify ancestry
|
|
120
|
+
compare_url = f"{github.base_url}/repos/{github.org}/{github.repo}/compare/{required_sha}...{current_sha}"
|
|
121
|
+
|
|
122
|
+
with httpx.Client() as client:
|
|
123
|
+
response = client.get(compare_url, headers=github.headers)
|
|
124
|
+
if response.status_code == 404:
|
|
125
|
+
return (
|
|
126
|
+
False,
|
|
127
|
+
f"Current branch does not include required SHA {required_sha[:7]}. Please rebase onto main.",
|
|
128
|
+
)
|
|
129
|
+
response.raise_for_status()
|
|
130
|
+
|
|
131
|
+
data = response.json()
|
|
132
|
+
status = data.get("status")
|
|
70
133
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if sha_to_check in log_output or sha_to_check[:7] in log_output:
|
|
134
|
+
# If status is 'ahead' or 'identical', required SHA is ancestor (good)
|
|
135
|
+
# If status is 'behind', current is behind required (bad)
|
|
136
|
+
if status in ["ahead", "identical"]:
|
|
75
137
|
return True, None
|
|
76
138
|
else:
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
f"
|
|
139
|
+
return (
|
|
140
|
+
False,
|
|
141
|
+
f"Current branch does not include required SHA {required_sha[:7]}. Please rebase onto main.",
|
|
80
142
|
)
|
|
81
|
-
except Exception as e:
|
|
82
|
-
return False, f"Git log search failed: {e}"
|
|
83
143
|
|
|
84
|
-
except InvalidGitRepositoryError:
|
|
85
|
-
return False, "Current directory is not a Git repository"
|
|
86
144
|
except Exception as e:
|
|
87
|
-
|
|
145
|
+
# Re-raise to be caught by the caller for proper fallback handling
|
|
146
|
+
raise Exception(f"GitHub API validation error: {e}") from e
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _validate_sha_in_log(repo: "Repo", sha_to_check: str) -> Tuple[bool, Optional[str]]:
|
|
150
|
+
"""Helper function to validate SHA exists in git log output."""
|
|
151
|
+
try:
|
|
152
|
+
log_output = repo.git.log("--oneline", "--all")
|
|
153
|
+
if sha_to_check in log_output or sha_to_check[:7] in log_output:
|
|
154
|
+
return True, None
|
|
155
|
+
else:
|
|
156
|
+
return False, (
|
|
157
|
+
f"Required commit {sha_to_check} not found in Git history. "
|
|
158
|
+
f"Please update to a branch that includes this commit."
|
|
159
|
+
)
|
|
160
|
+
except Exception as e:
|
|
161
|
+
return False, f"Git log search failed: {e}"
|
|
88
162
|
|
|
89
163
|
|
|
90
164
|
def get_validation_error_message(required_sha: Optional[str] = None) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: superset-showtime
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.11
|
|
4
4
|
Summary: 🎪 Apache Superset ephemeral environment management with circus tent emoji state tracking
|
|
5
5
|
Project-URL: Homepage, https://github.com/apache/superset-showtime
|
|
6
6
|
Project-URL: Documentation, https://superset-showtime.readthedocs.io/
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
showtime/__init__.py,sha256=
|
|
1
|
+
showtime/__init__.py,sha256=HcxA_d-Wu3K1hL8OL_1I6y3u8cclS3dbUSMbv4RG2GA,449
|
|
2
2
|
showtime/__main__.py,sha256=EVaDaTX69yIhCzChg99vqvFSCN4ELstEt7Mpb9FMZX8,109
|
|
3
3
|
showtime/cli.py,sha256=8vIJT5TiqXuHDGxRBg6jV3oNv5nKrmDOs5OgltycPeI,31664
|
|
4
4
|
showtime/core/__init__.py,sha256=54hbdFNGrzuNMBdraezfjT8Zi6g221pKlJ9mREnKwCw,34
|
|
5
5
|
showtime/core/aws.py,sha256=uTjJAvEBQMyTccS93WZeNPhfeKQhJgOQQ0BJdnQjvCU,35007
|
|
6
6
|
showtime/core/emojis.py,sha256=MHEDuPIdfNiop4zbNLuviz3eY05QiftYSHHCVbkfKhw,2129
|
|
7
|
-
showtime/core/git_validation.py,sha256=
|
|
7
|
+
showtime/core/git_validation.py,sha256=Knr-9IAHXlhhkBeReJPlqzBG_TDWlevIqYaB26OPM04,6686
|
|
8
8
|
showtime/core/github.py,sha256=uETvKDO2Yhpqg3fxLtrKaCuZR3b-1LVmgnf5aLcqrAQ,9988
|
|
9
9
|
showtime/core/github_messages.py,sha256=MfgwCukrEsWWesMsuL8saciDgP4nS-gijzu8DXr-Alg,7450
|
|
10
10
|
showtime/core/label_colors.py,sha256=efhbFnz_3nqEnEqmgyF6_hZbxtCu_fmb68BIIUpSsnk,3895
|
|
11
11
|
showtime/core/pull_request.py,sha256=vKlPPlIeSNT_WmlZkOekLH_tGYm4pyJUZFHQC9dVCKY,27756
|
|
12
12
|
showtime/core/show.py,sha256=FpxDm52LASCJvf8UF998AtNiVzfdYIwNEsPAsOAAwL0,9701
|
|
13
13
|
showtime/data/ecs-task-definition.json,sha256=Y8ZbAAXdIDMnM-8zzfdUTlwp5RpWSyhe1gtfygKkqW8,2343
|
|
14
|
-
superset_showtime-0.5.
|
|
15
|
-
superset_showtime-0.5.
|
|
16
|
-
superset_showtime-0.5.
|
|
17
|
-
superset_showtime-0.5.
|
|
14
|
+
superset_showtime-0.5.11.dist-info/METADATA,sha256=Ekcs0XHNPJC-W8ZfULfh8CqbZTpKehGk1yJWirNOYAE,12053
|
|
15
|
+
superset_showtime-0.5.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
superset_showtime-0.5.11.dist-info/entry_points.txt,sha256=rDW7oZ57mqyBUS4N_3_R7bZNGVHB-104jwmY-hHC_ck,85
|
|
17
|
+
superset_showtime-0.5.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|