superset-showtime 0.5.1__tar.gz → 0.5.4__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.
Potentially problematic release.
This version of superset-showtime might be problematic. Click here for more details.
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/PKG-INFO +1 -1
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/__init__.py +1 -1
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/pull_request.py +74 -6
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/show.py +5 -5
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/tests/unit/test_label_transitions.py +34 -1
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/tests/unit/test_pull_request.py +6 -6
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/.claude/settings.local.json +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/.gitignore +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/.pre-commit-config.yaml +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/CLAUDE.md +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/Makefile +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/README.md +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/dev-setup.sh +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/pypi-push.sh +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/pyproject.toml +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/requirements-dev.txt +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/requirements.txt +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/__main__.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/cli.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/__init__.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/aws.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/emojis.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/github.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/github_messages.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/core/label_colors.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/showtime/data/ecs-task-definition.json +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/tests/__init__.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/tests/unit/__init__.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/tests/unit/test_sha_specific_logic.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/tests/unit/test_show.py +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/uv.lock +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/workflows-reference/showtime-cleanup.yml +0 -0
- {superset_showtime-0.5.1 → superset_showtime-0.5.4}/workflows-reference/showtime-trigger.yml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: superset-showtime
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
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/
|
|
@@ -246,6 +246,9 @@ class PullRequest:
|
|
|
246
246
|
print(f"✅ Deployment completed - environment running at {show.ip}:8080")
|
|
247
247
|
self._update_show_labels(show, dry_run_github)
|
|
248
248
|
|
|
249
|
+
# Blue-green cleanup: stop all other environments for this PR
|
|
250
|
+
cleaned_count = self.stop_previous_environments(show.sha, dry_run_github, dry_run_aws)
|
|
251
|
+
|
|
249
252
|
# Show AWS console URLs for monitoring
|
|
250
253
|
self._show_service_urls(show)
|
|
251
254
|
|
|
@@ -278,6 +281,9 @@ class PullRequest:
|
|
|
278
281
|
print(f"✅ Rolling update completed - new environment at {new_show.ip}:8080")
|
|
279
282
|
self._update_show_labels(new_show, dry_run_github)
|
|
280
283
|
|
|
284
|
+
# Blue-green cleanup: stop all other environments for this PR
|
|
285
|
+
cleaned_count = self.stop_previous_environments(new_show.sha, dry_run_github, dry_run_aws)
|
|
286
|
+
|
|
281
287
|
# Show AWS console URLs for monitoring
|
|
282
288
|
self._show_service_urls(new_show)
|
|
283
289
|
|
|
@@ -389,6 +395,9 @@ class PullRequest:
|
|
|
389
395
|
|
|
390
396
|
def _determine_action(self, target_sha: str) -> str:
|
|
391
397
|
"""Determine what sync action is needed based on target SHA state"""
|
|
398
|
+
# CRITICAL: Get fresh labels before any decisions
|
|
399
|
+
self.refresh_labels()
|
|
400
|
+
|
|
392
401
|
target_sha_short = target_sha[:7] # Ensure we're working with short SHA
|
|
393
402
|
|
|
394
403
|
# Get the specific show for the target SHA
|
|
@@ -429,20 +438,20 @@ class PullRequest:
|
|
|
429
438
|
|
|
430
439
|
def _atomic_claim(self, target_sha: str, action: str, dry_run: bool = False) -> bool:
|
|
431
440
|
"""Atomically claim this PR for the current job based on target SHA state"""
|
|
441
|
+
# CRITICAL: Get fresh labels before any decisions
|
|
442
|
+
self.refresh_labels()
|
|
443
|
+
|
|
432
444
|
target_sha_short = target_sha[:7]
|
|
433
445
|
target_show = self.get_show_by_sha(target_sha_short)
|
|
434
446
|
|
|
435
|
-
# 1. Validate current state allows this action for target SHA
|
|
447
|
+
# 1. Validate current state allows this action for target SHA
|
|
436
448
|
if action in ["create_environment", "rolling_update", "auto_sync"]:
|
|
437
449
|
if target_show and target_show.status in [
|
|
438
450
|
"building",
|
|
439
451
|
"built",
|
|
440
|
-
"deploying",
|
|
452
|
+
"deploying",
|
|
441
453
|
]:
|
|
442
|
-
return False # Target SHA already in progress
|
|
443
|
-
|
|
444
|
-
# Allow actions on failed, running, or non-existent target SHAs
|
|
445
|
-
return True
|
|
454
|
+
return False # Target SHA already in progress - ONLY conflict case returns
|
|
446
455
|
|
|
447
456
|
if dry_run:
|
|
448
457
|
print(f"🎪 [DRY-RUN] Would atomically claim PR for {action}")
|
|
@@ -580,6 +589,17 @@ class PullRequest:
|
|
|
580
589
|
for old_status_label in sha_status_labels:
|
|
581
590
|
get_github().remove_label(self.pr_number, old_status_label)
|
|
582
591
|
|
|
592
|
+
# For running environments, ensure only ONE active pointer exists
|
|
593
|
+
if show.status == "running":
|
|
594
|
+
# Remove ALL existing active pointers (there should only be one)
|
|
595
|
+
existing_active_pointers = [
|
|
596
|
+
label for label in self.labels
|
|
597
|
+
if label.startswith("🎪 🎯 ")
|
|
598
|
+
]
|
|
599
|
+
for old_pointer in existing_active_pointers:
|
|
600
|
+
print(f"🎯 Removing old active pointer: {old_pointer}")
|
|
601
|
+
get_github().remove_label(self.pr_number, old_pointer)
|
|
602
|
+
|
|
583
603
|
# Now do normal differential updates - only for this SHA
|
|
584
604
|
current_sha_labels = {
|
|
585
605
|
label for label in self.labels
|
|
@@ -616,3 +636,51 @@ class PullRequest:
|
|
|
616
636
|
print(f"📝 Logs: {urls['logs']}")
|
|
617
637
|
print(f"📊 Service: {urls['service']}")
|
|
618
638
|
print("")
|
|
639
|
+
|
|
640
|
+
def stop_previous_environments(self, keep_sha: str, dry_run_github: bool = False, dry_run_aws: bool = False) -> int:
|
|
641
|
+
"""Stop all environments except the specified SHA (blue-green cleanup)
|
|
642
|
+
|
|
643
|
+
Args:
|
|
644
|
+
keep_sha: SHA of environment to keep running
|
|
645
|
+
dry_run_github: Skip GitHub label operations
|
|
646
|
+
dry_run_aws: Skip AWS operations
|
|
647
|
+
|
|
648
|
+
Returns:
|
|
649
|
+
Number of environments stopped
|
|
650
|
+
"""
|
|
651
|
+
# CRITICAL: Refresh to get current shows including newly created one
|
|
652
|
+
self.refresh_labels()
|
|
653
|
+
|
|
654
|
+
stopped_count = 0
|
|
655
|
+
|
|
656
|
+
for show in self.shows:
|
|
657
|
+
if show.sha != keep_sha:
|
|
658
|
+
print(f"🧹 Cleaning up old environment: {show.sha} ({show.status})")
|
|
659
|
+
try:
|
|
660
|
+
show.stop(dry_run_github=dry_run_github, dry_run_aws=dry_run_aws)
|
|
661
|
+
|
|
662
|
+
# Remove labels for this old environment
|
|
663
|
+
if not dry_run_github:
|
|
664
|
+
old_labels = show.to_circus_labels()
|
|
665
|
+
print(f"🏷️ Removing labels for {show.sha}: {len(old_labels)} labels")
|
|
666
|
+
for label in old_labels:
|
|
667
|
+
try:
|
|
668
|
+
get_github().remove_label(self.pr_number, label)
|
|
669
|
+
except Exception as e:
|
|
670
|
+
print(f"⚠️ Failed to remove label {label}: {e}")
|
|
671
|
+
|
|
672
|
+
stopped_count += 1
|
|
673
|
+
print(f"✅ Stopped environment {show.sha}")
|
|
674
|
+
|
|
675
|
+
except Exception as e:
|
|
676
|
+
print(f"❌ Failed to stop environment {show.sha}: {e}")
|
|
677
|
+
|
|
678
|
+
if stopped_count > 0:
|
|
679
|
+
print(f"🧹 Blue-green cleanup: stopped {stopped_count} old environments")
|
|
680
|
+
# Refresh labels after cleanup
|
|
681
|
+
if not dry_run_github:
|
|
682
|
+
self.refresh_labels()
|
|
683
|
+
else:
|
|
684
|
+
print("ℹ️ No old environments to clean up")
|
|
685
|
+
|
|
686
|
+
return stopped_count
|
|
@@ -165,17 +165,17 @@ class Show:
|
|
|
165
165
|
|
|
166
166
|
# Detect if running in CI environment
|
|
167
167
|
is_ci = bool(os.getenv("GITHUB_ACTIONS") or os.getenv("CI"))
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
# Build command without final path
|
|
170
170
|
cmd = [
|
|
171
171
|
"docker",
|
|
172
|
-
"buildx",
|
|
172
|
+
"buildx",
|
|
173
173
|
"build",
|
|
174
174
|
"--push",
|
|
175
175
|
"--platform",
|
|
176
176
|
"linux/amd64",
|
|
177
177
|
"--target",
|
|
178
|
-
"
|
|
178
|
+
"showtime",
|
|
179
179
|
"--build-arg",
|
|
180
180
|
"INCLUDE_CHROMIUM=false",
|
|
181
181
|
"--build-arg",
|
|
@@ -190,7 +190,7 @@ class Show:
|
|
|
190
190
|
cmd.extend([
|
|
191
191
|
"--cache-from",
|
|
192
192
|
"type=registry,ref=apache/superset-cache:showtime",
|
|
193
|
-
"--cache-to",
|
|
193
|
+
"--cache-to",
|
|
194
194
|
"type=registry,mode=max,ref=apache/superset-cache:showtime",
|
|
195
195
|
])
|
|
196
196
|
print("🐳 CI environment: Using full registry caching")
|
|
@@ -204,7 +204,7 @@ class Show:
|
|
|
204
204
|
|
|
205
205
|
# Add --load only when explicitly requested for local testing
|
|
206
206
|
force_load = os.getenv("DOCKER_LOAD", "false").lower() == "true"
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
if force_load:
|
|
209
209
|
cmd.append("--load")
|
|
210
210
|
print("🐳 Will load image to local Docker daemon (DOCKER_LOAD=true)")
|
|
@@ -281,4 +281,37 @@ def test_status_label_identification_edge_cases():
|
|
|
281
281
|
|
|
282
282
|
# Should not match other SHAs or malformed labels
|
|
283
283
|
assert "🎪 def456a 🚦 running" not in sha_status_labels
|
|
284
|
-
assert "🎪 abc123f🚦building" not in sha_status_labels
|
|
284
|
+
assert "🎪 abc123f🚦building" not in sha_status_labels
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
@patch('showtime.core.pull_request.get_github')
|
|
288
|
+
def test_atomic_claim_actually_creates_labels(mock_get_github):
|
|
289
|
+
"""Test that atomic claim ACTUALLY creates labels, not just claims success"""
|
|
290
|
+
mock_github = Mock()
|
|
291
|
+
mock_github.get_labels.return_value = ["🎪 ⚡ showtime-trigger-start", "bug"]
|
|
292
|
+
mock_get_github.return_value = mock_github
|
|
293
|
+
|
|
294
|
+
pr = PullRequest(1234, ["🎪 ⚡ showtime-trigger-start", "bug"])
|
|
295
|
+
|
|
296
|
+
# Mock show creation
|
|
297
|
+
with patch.object(pr, '_create_new_show') as mock_create:
|
|
298
|
+
mock_show = Show(pr_number=1234, sha="abc123f", status="building")
|
|
299
|
+
mock_create.return_value = mock_show
|
|
300
|
+
|
|
301
|
+
result = pr._atomic_claim("abc123f", "create_environment", dry_run=False)
|
|
302
|
+
|
|
303
|
+
assert result is True
|
|
304
|
+
|
|
305
|
+
# The CRITICAL assertions - verify actual label operations happened
|
|
306
|
+
mock_github.remove_label.assert_called() # Should remove triggers
|
|
307
|
+
mock_github.add_label.assert_called() # Should add building labels
|
|
308
|
+
|
|
309
|
+
# Verify trigger was removed
|
|
310
|
+
trigger_removes = [call for call in mock_github.remove_label.call_args_list
|
|
311
|
+
if "showtime-trigger-start" in str(call)]
|
|
312
|
+
assert len(trigger_removes) > 0, "Trigger label should be removed"
|
|
313
|
+
|
|
314
|
+
# Verify building labels were added
|
|
315
|
+
building_adds = [call for call in mock_github.add_label.call_args_list
|
|
316
|
+
if "🚦 building" in str(call)]
|
|
317
|
+
assert len(building_adds) > 0, "Building status label should be added"
|
|
@@ -106,17 +106,17 @@ def test_pullrequest_determine_action():
|
|
|
106
106
|
pr_start = PullRequest(1234, ["🎪 ⚡ showtime-trigger-start"])
|
|
107
107
|
assert pr_start._determine_action("abc123f") == "create_environment"
|
|
108
108
|
|
|
109
|
-
# Start trigger, same SHA -
|
|
109
|
+
# Start trigger, same SHA - force rebuild with trigger
|
|
110
110
|
pr_same = PullRequest(
|
|
111
111
|
1234, ["🎪 ⚡ showtime-trigger-start", "🎪 abc123f 🚦 running", "🎪 🎯 abc123f"]
|
|
112
112
|
)
|
|
113
|
-
assert pr_same._determine_action("abc123f") == "
|
|
113
|
+
assert pr_same._determine_action("abc123f") == "create_environment"
|
|
114
114
|
|
|
115
|
-
# Start trigger, different SHA -
|
|
115
|
+
# Start trigger, different SHA - create new environment (SHA-specific logic)
|
|
116
116
|
pr_update = PullRequest(
|
|
117
117
|
1234, ["🎪 ⚡ showtime-trigger-start", "🎪 abc123f 🚦 running", "🎪 🎯 abc123f"]
|
|
118
118
|
)
|
|
119
|
-
assert pr_update._determine_action("def456a") == "
|
|
119
|
+
assert pr_update._determine_action("def456a") == "create_environment"
|
|
120
120
|
|
|
121
121
|
# Stop trigger - destroy
|
|
122
122
|
pr_stop = PullRequest(
|
|
@@ -124,9 +124,9 @@ def test_pullrequest_determine_action():
|
|
|
124
124
|
)
|
|
125
125
|
assert pr_stop._determine_action("def456a") == "destroy_environment"
|
|
126
126
|
|
|
127
|
-
# No triggers, but
|
|
127
|
+
# No triggers, but different SHA - create new environment (SHA-specific)
|
|
128
128
|
pr_auto = PullRequest(1234, ["🎪 abc123f 🚦 running", "🎪 🎯 abc123f"])
|
|
129
|
-
assert pr_auto._determine_action("def456a") == "
|
|
129
|
+
assert pr_auto._determine_action("def456a") == "create_environment"
|
|
130
130
|
|
|
131
131
|
# Failed environment, no triggers - create new (retry logic)
|
|
132
132
|
pr_failed = PullRequest(1234, ["🎪 abc123f 🚦 failed", "🎪 🎯 abc123f"])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superset_showtime-0.5.1 → superset_showtime-0.5.4}/workflows-reference/showtime-cleanup.yml
RENAMED
|
File without changes
|
{superset_showtime-0.5.1 → superset_showtime-0.5.4}/workflows-reference/showtime-trigger.yml
RENAMED
|
File without changes
|