superset-showtime 0.2.8__tar.gz → 0.3.1__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.2.8 → superset_showtime-0.3.1}/.claude/settings.local.json +5 -1
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/CLAUDE.md +67 -36
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/PKG-INFO +42 -115
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/README.md +41 -114
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/__init__.py +1 -1
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/cli.py +410 -56
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/circus.py +11 -1
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/github_messages.py +11 -1
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/workflows-reference/showtime-trigger.yml +28 -59
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/.gitignore +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/.pre-commit-config.yaml +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/Makefile +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/dev-setup.sh +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/pypi-push.sh +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/pyproject.toml +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/requirements-dev.txt +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/requirements.txt +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/__main__.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/commands/__init__.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/commands/start.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/__init__.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/aws.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/emojis.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/github.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/label_colors.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/data/ecs-task-definition.json +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/tests/__init__.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/tests/unit/__init__.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/tests/unit/test_circus.py +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/uv.lock +0 -0
- {superset_showtime-0.2.8 → superset_showtime-0.3.1}/workflows-reference/showtime-cleanup.yml +0 -0
|
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
4
4
|
|
|
5
5
|
## Project Overview
|
|
6
6
|
|
|
7
|
-
Superset Showtime is a Python CLI tool for managing Apache Superset ephemeral environments using **circus tent emoji labels** as a state management system on GitHub PRs. The system
|
|
7
|
+
Superset Showtime is a Python CLI tool for managing Apache Superset ephemeral environments using **circus tent emoji labels** as a state management system on GitHub PRs. The system implements **ACID-style atomic transactions** using GitHub labels as a distributed coordination mechanism, with **compare-and-swap** patterns to prevent race conditions.
|
|
8
8
|
|
|
9
9
|
## Development Commands
|
|
10
10
|
|
|
@@ -22,11 +22,11 @@ python -m showtime labels # Complete label reference
|
|
|
22
22
|
python -m showtime list # List all environments (requires GITHUB_TOKEN)
|
|
23
23
|
python -m showtime test-lifecycle 1234 # Full workflow simulation
|
|
24
24
|
|
|
25
|
-
# Test
|
|
25
|
+
# Test new unified sync command
|
|
26
26
|
export GITHUB_TOKEN=xxx
|
|
27
|
-
showtime
|
|
28
|
-
showtime
|
|
29
|
-
showtime
|
|
27
|
+
showtime sync 34809 --check-only # Analyze what's needed
|
|
28
|
+
showtime sync 34809 --dry-run-aws --dry-run-docker # Test full flow safely
|
|
29
|
+
showtime set-state building 34809 # Manual state transitions
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### Testing Single Components
|
|
@@ -39,10 +39,19 @@ python -c "from showtime.core.circus import Show; show = Show(pr_number=1234, sh
|
|
|
39
39
|
## Architecture Overview
|
|
40
40
|
|
|
41
41
|
### Core State Management Pattern
|
|
42
|
-
The system uses **GitHub labels as a distributed
|
|
43
|
-
- **Trigger labels** (`🎪 trigger-start`) - Commands added by users, processed and removed
|
|
44
|
-
- **State labels** (`🎪 🚦
|
|
42
|
+
The system uses **GitHub labels as a distributed ACID-style database**:
|
|
43
|
+
- **Trigger labels** (`🎪 ⚡ showtime-trigger-start`) - Commands added by users, atomically processed and removed
|
|
44
|
+
- **State labels** (`🎪 abc123f 🚦 building`) - Per-SHA status managed with atomic compare-and-swap operations
|
|
45
45
|
- **No external database** - All state reconstructed from GitHub labels
|
|
46
|
+
- **Race condition prevention** - Atomic claim prevents double-processing of triggers
|
|
47
|
+
|
|
48
|
+
### Enhanced State Lifecycle
|
|
49
|
+
**Complete state progression**: `building → built → deploying → running/failed`
|
|
50
|
+
- **building**: Docker image construction in progress
|
|
51
|
+
- **built**: Docker build complete, ready for AWS deployment
|
|
52
|
+
- **deploying**: AWS ECS deployment in progress
|
|
53
|
+
- **running**: Environment live and accessible
|
|
54
|
+
- **failed**: Build or deployment failed
|
|
46
55
|
|
|
47
56
|
### Key Classes and Responsibilities
|
|
48
57
|
|
|
@@ -96,8 +105,9 @@ Replicates current GitHub Actions AWS logic:
|
|
|
96
105
|
- **Security model**: `pull_request_target` + PyPI install (no PR code execution)
|
|
97
106
|
|
|
98
107
|
#### CLI Commands Called by GHA
|
|
99
|
-
- `showtime
|
|
100
|
-
- `showtime
|
|
108
|
+
- `showtime sync {pr-number} --check-only` - Analyze state and determine build_needed
|
|
109
|
+
- `showtime sync {pr-number} --sha {sha}` - Execute atomic claim + build + deploy
|
|
110
|
+
- `showtime set-state {state} {pr-number}` - Manual state transitions
|
|
101
111
|
- `showtime cleanup --older-than 48h` - Scheduled cleanup
|
|
102
112
|
|
|
103
113
|
## Important Implementation Details
|
|
@@ -114,15 +124,23 @@ The CLI has comprehensive dry-run support for safe testing:
|
|
|
114
124
|
```bash
|
|
115
125
|
--dry-run-aws # Skip AWS operations, use mock data
|
|
116
126
|
--dry-run-github # Skip GitHub operations, show what would happen
|
|
127
|
+
--dry-run-docker # Skip Docker build, use mock success
|
|
117
128
|
--aws-sleep N # Sleep N seconds to simulate AWS timing
|
|
118
129
|
```
|
|
119
130
|
|
|
120
|
-
### AWS Resource Naming
|
|
121
|
-
|
|
131
|
+
### AWS Resource Naming & Docker Integration
|
|
132
|
+
**Direct Docker build** (no supersetbot dependency):
|
|
133
|
+
- **Docker Image**: `apache/superset:pr-{pr_number}-{sha}-ci` (single tag, built directly)
|
|
122
134
|
- **ECS Service**: `pr-{pr_number}-{sha}` (e.g., `pr-1234-abc123f`)
|
|
123
|
-
- **ECR Image**: `pr-{pr_number}-{sha}-ci`
|
|
124
135
|
- **Network**: Same subnets/security groups as current production setup
|
|
125
136
|
|
|
137
|
+
**Docker Build Command**:
|
|
138
|
+
```bash
|
|
139
|
+
docker buildx build --push --load --platform linux/amd64 --target ci \
|
|
140
|
+
--build-arg INCLUDE_CHROMIUM=false --build-arg LOAD_EXAMPLES_DUCKDB=true \
|
|
141
|
+
-t apache/superset:pr-{pr}-{sha}-ci .
|
|
142
|
+
```
|
|
143
|
+
|
|
126
144
|
### State Recovery Pattern
|
|
127
145
|
Since the CLI is stateless, it always reconstructs state from GitHub labels:
|
|
128
146
|
```python
|
|
@@ -133,15 +151,22 @@ show = pr.current_show # Finds active environment
|
|
|
133
151
|
|
|
134
152
|
## Critical Development Notes
|
|
135
153
|
|
|
136
|
-
###
|
|
137
|
-
GitHub label operations
|
|
154
|
+
### ACID-Style Atomic Transactions
|
|
155
|
+
GitHub label operations implement compare-and-swap pattern for race condition prevention:
|
|
138
156
|
```python
|
|
139
|
-
#
|
|
140
|
-
|
|
141
|
-
#
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
# Atomic claim pattern in _atomic_claim_environment():
|
|
158
|
+
# 1. CHECK: Validate current state allows new work
|
|
159
|
+
# 2. COMPARE: Ensure triggers exist and state is valid
|
|
160
|
+
# 3. SWAP: Remove triggers + Set building state atomically
|
|
161
|
+
# 4. COMMIT: Environment successfully claimed
|
|
162
|
+
|
|
163
|
+
# Example atomic transaction:
|
|
164
|
+
if not _validate_non_active_state(pr):
|
|
165
|
+
return False # Another job already active
|
|
166
|
+
github.remove_label(pr_number, trigger_label) # Remove trigger
|
|
167
|
+
github.remove_circus_labels(pr_number) # Clear stale state
|
|
168
|
+
for label in building_show.to_circus_labels():
|
|
169
|
+
github.add_label(pr_number, label) # Set building state
|
|
145
170
|
```
|
|
146
171
|
|
|
147
172
|
### Per-SHA Format Required
|
|
@@ -166,16 +191,14 @@ showtime stop 34809 --force
|
|
|
166
191
|
|
|
167
192
|
## Current Implementation Status
|
|
168
193
|
|
|
169
|
-
### ✅
|
|
170
|
-
- **
|
|
171
|
-
- **
|
|
172
|
-
- **
|
|
173
|
-
- **
|
|
174
|
-
- **
|
|
175
|
-
- **
|
|
176
|
-
- **
|
|
177
|
-
- **Enhanced CLI**: Clickable links, full-width tables, real-time progress
|
|
178
|
-
- **Unified label system**: Searchable namespaced labels with color themes
|
|
194
|
+
### ✅ Current Architecture (Production Ready)
|
|
195
|
+
- **ACID-style transactions**: Atomic compare-and-swap prevents race conditions
|
|
196
|
+
- **Direct Docker integration**: No supersetbot dependency, single tag builds
|
|
197
|
+
- **Streamlined GitHub Actions**: 3-step workflow (check → setup → sync)
|
|
198
|
+
- **Enhanced state machine**: building→built→deploying→running/failed lifecycle
|
|
199
|
+
- **Unified sync command**: Handles atomic claim + build + deploy in one command
|
|
200
|
+
- **Smart conditionals**: Skip Docker setup when build_needed=false
|
|
201
|
+
- **Race condition safe**: Multiple jobs can't double-process triggers
|
|
179
202
|
|
|
180
203
|
### 🎯 Label System (Streamlined)
|
|
181
204
|
- **Trigger labels**: `🎪 ⚡ showtime-trigger-start` (namespaced, searchable)
|
|
@@ -183,8 +206,16 @@ showtime stop 34809 --force
|
|
|
183
206
|
- **Freeze support**: `🎪 🧊 showtime-freeze` (prevents auto-sync)
|
|
184
207
|
- **Automatic creation**: Labels get proper colors/descriptions automatically
|
|
185
208
|
|
|
186
|
-
### 📦
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
209
|
+
### 📦 Key Commands for Development
|
|
210
|
+
```bash
|
|
211
|
+
# Core sync command (replaces handle-trigger, handle-sync):
|
|
212
|
+
showtime sync PR_NUMBER --check-only # Returns build_needed + target_sha
|
|
213
|
+
showtime sync PR_NUMBER --sha SHA # Atomic claim + build + deploy
|
|
214
|
+
|
|
215
|
+
# Manual state management:
|
|
216
|
+
showtime set-state building PR_NUMBER # Set specific state
|
|
217
|
+
showtime set-state failed PR_NUMBER --error-msg "Build failed"
|
|
218
|
+
|
|
219
|
+
# Development testing:
|
|
220
|
+
showtime sync PR_NUMBER --dry-run-aws --dry-run-docker --dry-run-github
|
|
221
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: superset-showtime
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
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/
|
|
@@ -113,9 +113,34 @@ Superset Showtime is a CLI tool designed primarily for **GitHub Actions** to man
|
|
|
113
113
|
🎪 abc123f 🌐 52-1-2-3 # Available at http://52.1.2.3:8080
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
### 🔄 Showtime Workflow
|
|
117
|
+
|
|
118
|
+
```mermaid
|
|
119
|
+
flowchart TD
|
|
120
|
+
A[User adds 🎪 ⚡ trigger-start] --> B[GitHub Actions: sync]
|
|
121
|
+
B --> C{Current state?}
|
|
122
|
+
|
|
123
|
+
C -->|No environment| D[🔒 Claim: Remove trigger + Set building]
|
|
124
|
+
C -->|Running + new SHA| E[🔒 Claim: Remove trigger + Set building]
|
|
125
|
+
C -->|Already building| F[❌ Exit: Another job active]
|
|
126
|
+
C -->|No triggers| G[❌ Exit: Nothing to do]
|
|
127
|
+
|
|
128
|
+
D --> H[📋 State: building]
|
|
129
|
+
E --> H
|
|
130
|
+
H --> I[🐳 Docker build]
|
|
131
|
+
I -->|Success| J[📋 State: built]
|
|
132
|
+
I -->|Fail| K[📋 State: failed]
|
|
133
|
+
|
|
134
|
+
J --> L[📋 State: deploying]
|
|
135
|
+
L --> M[☁️ AWS Deploy]
|
|
136
|
+
M -->|Success| N[📋 State: running]
|
|
137
|
+
M -->|Fail| O[📋 State: failed]
|
|
138
|
+
|
|
139
|
+
N --> P[🎪 Environment ready!]
|
|
140
|
+
|
|
141
|
+
Q[User adds 🎪 🛑 trigger-stop] --> R[🧹 Cleanup AWS + Remove labels]
|
|
142
|
+
```
|
|
117
143
|
|
|
118
|
-
> **Note**: CLI is mainly for debugging or developing Showtime itself. Primary interface is GitHub labels above.
|
|
119
144
|
|
|
120
145
|
**Install CLI for debugging:**
|
|
121
146
|
```bash
|
|
@@ -229,129 +254,31 @@ You'll see:
|
|
|
229
254
|
|
|
230
255
|
### GitHub Actions Integration
|
|
231
256
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
```yaml
|
|
235
|
-
# .github/workflows/showtime.yml - Integrates with Superset's existing build workflows
|
|
236
|
-
on:
|
|
237
|
-
pull_request_target:
|
|
238
|
-
types: [labeled, unlabeled, synchronize]
|
|
239
|
-
|
|
240
|
-
jobs:
|
|
241
|
-
showtime-handler:
|
|
242
|
-
if: contains(github.event.label.name, '🎪')
|
|
243
|
-
steps:
|
|
244
|
-
- name: Install Showtime from PyPI
|
|
245
|
-
run: pip install superset-showtime
|
|
246
|
-
|
|
247
|
-
- name: Process circus triggers
|
|
248
|
-
run: python -m showtime handle-trigger ${{ github.event.pull_request.number }}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
**Integration approach:**
|
|
252
|
-
- **Coordinates with Superset builds** - Uses existing container build workflows
|
|
253
|
-
- **Runs trusted code** (from PyPI, not PR code)
|
|
254
|
-
- **Simple orchestration logic** (install CLI and run commands)
|
|
255
|
-
- **Leverages existing infrastructure** - Same AWS resources and permissions
|
|
256
|
-
|
|
257
|
-
## 🛠️ Installation & Setup
|
|
258
|
-
|
|
259
|
-
### For Contributors (GitHub Labels Only)
|
|
260
|
-
No installation needed! Just use GitHub labels to trigger environments.
|
|
261
|
-
|
|
262
|
-
### For Maintainers (Manual CLI Operations)
|
|
257
|
+
**🎯 Live Workflow**: [showtime-trigger.yml](https://github.com/apache/superset/actions/workflows/showtime-trigger.yml)
|
|
263
258
|
|
|
264
|
-
**
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
259
|
+
**How it works:**
|
|
260
|
+
- Triggers on PR label changes, commits, and closures
|
|
261
|
+
- Installs `superset-showtime` from PyPI (trusted code, not PR code)
|
|
262
|
+
- Runs `showtime sync` to handle trigger processing and deployments
|
|
263
|
+
- Supports manual testing via `workflow_dispatch` with specific SHA override
|
|
269
264
|
|
|
270
|
-
**
|
|
265
|
+
**Commands used:**
|
|
271
266
|
```bash
|
|
272
|
-
showtime
|
|
273
|
-
showtime
|
|
274
|
-
showtime labels # Reference complete label system
|
|
267
|
+
showtime sync PR_NUMBER --check-only # Determine build_needed + target_sha
|
|
268
|
+
showtime sync PR_NUMBER --sha SHA # Execute atomic claim + build + deploy
|
|
275
269
|
```
|
|
276
270
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
**1. Install GitHub workflows:**
|
|
280
|
-
Copy `workflows-reference/showtime-trigger.yml` and `workflows-reference/showtime-cleanup.yml` to Superset's `.github/workflows/`.
|
|
281
|
-
|
|
282
|
-
**2. Configure secrets (already exist in Superset):**
|
|
283
|
-
- `AWS_ACCESS_KEY_ID`
|
|
284
|
-
- `AWS_SECRET_ACCESS_KEY`
|
|
285
|
-
- `GITHUB_TOKEN`
|
|
286
|
-
|
|
287
|
-
**3. Dependencies:**
|
|
288
|
-
Showtime coordinates with Superset's existing build infrastructure - no additional setup needed.
|
|
289
|
-
|
|
290
|
-
## 📊 CLI Reference (For Development/Debugging)
|
|
271
|
+
## 🛠️ CLI Usage
|
|
291
272
|
|
|
292
|
-
|
|
273
|
+
The CLI is primarily used by GitHub Actions, but available for debugging and advanced users:
|
|
293
274
|
|
|
294
|
-
### Debugging Commands
|
|
295
275
|
```bash
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
showtime
|
|
299
|
-
showtime test-lifecycle 1234 # Full workflow simulation
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### Manual Operations (Advanced)
|
|
303
|
-
```bash
|
|
304
|
-
showtime start 1234 # Manually create environment
|
|
305
|
-
showtime start 1234 --sha abc123f # Create environment (specific SHA)
|
|
306
|
-
showtime stop 1234 # Manually delete environment
|
|
307
|
-
showtime sync 1234 # Force sync to desired state
|
|
308
|
-
showtime cleanup --respect-ttl # Manual cleanup
|
|
276
|
+
pip install superset-showtime
|
|
277
|
+
export GITHUB_TOKEN=your_token
|
|
278
|
+
showtime --help # See all available commands
|
|
309
279
|
```
|
|
310
280
|
|
|
311
|
-
### GitHub Actions Commands
|
|
312
|
-
```bash
|
|
313
|
-
showtime handle-trigger 1234 # Process trigger labels (called by GHA)
|
|
314
|
-
showtime cleanup --older-than 48h # Scheduled cleanup (called by GHA)
|
|
315
|
-
```
|
|
316
281
|
|
|
317
|
-
## 🎪 Benefits for Superset
|
|
318
|
-
|
|
319
|
-
### For Contributors
|
|
320
|
-
- **🎯 Simple workflow** - Just add/remove GitHub labels
|
|
321
|
-
- **👀 Visual feedback** - See environment status in PR labels
|
|
322
|
-
- **⚡ Automatic updates** - New commits update environments automatically
|
|
323
|
-
- **🔧 Configuration testing** - Test config changes through code commits
|
|
324
|
-
|
|
325
|
-
### For Maintainers
|
|
326
|
-
- **📊 Complete visibility** - `showtime list` shows all environments
|
|
327
|
-
- **🧹 Easy cleanup** - Automatic expired environment cleanup
|
|
328
|
-
- **🔍 Better debugging** - Clear state in labels, comprehensive CLI
|
|
329
|
-
- **💰 Cost savings** - No duplicate environments, proper cleanup
|
|
330
|
-
|
|
331
|
-
### For Operations
|
|
332
|
-
- **📝 Simpler workflows** - Replace complex GHA scripts with simple CLI calls
|
|
333
|
-
- **🔒 Same security model** - No new permissions needed
|
|
334
|
-
- **🎯 Deterministic** - Predictable AWS resource naming
|
|
335
|
-
- **🚨 Monitoring ready** - 48h maximum lifetime, scheduled cleanup
|
|
336
|
-
|
|
337
|
-
## 🏗️ Architecture
|
|
338
|
-
|
|
339
|
-
### State Management
|
|
340
|
-
All state lives in **GitHub labels** - no external databases needed:
|
|
341
|
-
- **Trigger labels** (`🎪 trigger-*`) - Commands that get processed and removed
|
|
342
|
-
- **State labels** (`🎪 🚦 *`) - Current environment status, managed by CLI
|
|
343
|
-
|
|
344
|
-
### AWS Resources
|
|
345
|
-
Deterministic naming enables reliable cleanup:
|
|
346
|
-
- **ECS Service:** `pr-{pr_number}-{sha}` (e.g., `pr-1234-abc123f`)
|
|
347
|
-
- **ECR Image:** `pr-{pr_number}-{sha}-ci` (e.g., `pr-1234-abc123f-ci`)
|
|
348
|
-
|
|
349
|
-
### Rolling Updates
|
|
350
|
-
Zero-downtime updates by running multiple environments:
|
|
351
|
-
1. Keep old environment serving traffic
|
|
352
|
-
2. Build new environment in parallel
|
|
353
|
-
3. Switch traffic when new environment is healthy
|
|
354
|
-
4. Clean up old environment
|
|
355
282
|
|
|
356
283
|
## 🤝 Contributing
|
|
357
284
|
|
|
@@ -48,9 +48,34 @@ Superset Showtime is a CLI tool designed primarily for **GitHub Actions** to man
|
|
|
48
48
|
🎪 abc123f 🌐 52-1-2-3 # Available at http://52.1.2.3:8080
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### 🔄 Showtime Workflow
|
|
52
|
+
|
|
53
|
+
```mermaid
|
|
54
|
+
flowchart TD
|
|
55
|
+
A[User adds 🎪 ⚡ trigger-start] --> B[GitHub Actions: sync]
|
|
56
|
+
B --> C{Current state?}
|
|
57
|
+
|
|
58
|
+
C -->|No environment| D[🔒 Claim: Remove trigger + Set building]
|
|
59
|
+
C -->|Running + new SHA| E[🔒 Claim: Remove trigger + Set building]
|
|
60
|
+
C -->|Already building| F[❌ Exit: Another job active]
|
|
61
|
+
C -->|No triggers| G[❌ Exit: Nothing to do]
|
|
62
|
+
|
|
63
|
+
D --> H[📋 State: building]
|
|
64
|
+
E --> H
|
|
65
|
+
H --> I[🐳 Docker build]
|
|
66
|
+
I -->|Success| J[📋 State: built]
|
|
67
|
+
I -->|Fail| K[📋 State: failed]
|
|
68
|
+
|
|
69
|
+
J --> L[📋 State: deploying]
|
|
70
|
+
L --> M[☁️ AWS Deploy]
|
|
71
|
+
M -->|Success| N[📋 State: running]
|
|
72
|
+
M -->|Fail| O[📋 State: failed]
|
|
73
|
+
|
|
74
|
+
N --> P[🎪 Environment ready!]
|
|
75
|
+
|
|
76
|
+
Q[User adds 🎪 🛑 trigger-stop] --> R[🧹 Cleanup AWS + Remove labels]
|
|
77
|
+
```
|
|
52
78
|
|
|
53
|
-
> **Note**: CLI is mainly for debugging or developing Showtime itself. Primary interface is GitHub labels above.
|
|
54
79
|
|
|
55
80
|
**Install CLI for debugging:**
|
|
56
81
|
```bash
|
|
@@ -164,129 +189,31 @@ You'll see:
|
|
|
164
189
|
|
|
165
190
|
### GitHub Actions Integration
|
|
166
191
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
```yaml
|
|
170
|
-
# .github/workflows/showtime.yml - Integrates with Superset's existing build workflows
|
|
171
|
-
on:
|
|
172
|
-
pull_request_target:
|
|
173
|
-
types: [labeled, unlabeled, synchronize]
|
|
174
|
-
|
|
175
|
-
jobs:
|
|
176
|
-
showtime-handler:
|
|
177
|
-
if: contains(github.event.label.name, '🎪')
|
|
178
|
-
steps:
|
|
179
|
-
- name: Install Showtime from PyPI
|
|
180
|
-
run: pip install superset-showtime
|
|
181
|
-
|
|
182
|
-
- name: Process circus triggers
|
|
183
|
-
run: python -m showtime handle-trigger ${{ github.event.pull_request.number }}
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
**Integration approach:**
|
|
187
|
-
- **Coordinates with Superset builds** - Uses existing container build workflows
|
|
188
|
-
- **Runs trusted code** (from PyPI, not PR code)
|
|
189
|
-
- **Simple orchestration logic** (install CLI and run commands)
|
|
190
|
-
- **Leverages existing infrastructure** - Same AWS resources and permissions
|
|
191
|
-
|
|
192
|
-
## 🛠️ Installation & Setup
|
|
193
|
-
|
|
194
|
-
### For Contributors (GitHub Labels Only)
|
|
195
|
-
No installation needed! Just use GitHub labels to trigger environments.
|
|
196
|
-
|
|
197
|
-
### For Maintainers (Manual CLI Operations)
|
|
192
|
+
**🎯 Live Workflow**: [showtime-trigger.yml](https://github.com/apache/superset/actions/workflows/showtime-trigger.yml)
|
|
198
193
|
|
|
199
|
-
**
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
**How it works:**
|
|
195
|
+
- Triggers on PR label changes, commits, and closures
|
|
196
|
+
- Installs `superset-showtime` from PyPI (trusted code, not PR code)
|
|
197
|
+
- Runs `showtime sync` to handle trigger processing and deployments
|
|
198
|
+
- Supports manual testing via `workflow_dispatch` with specific SHA override
|
|
204
199
|
|
|
205
|
-
**
|
|
200
|
+
**Commands used:**
|
|
206
201
|
```bash
|
|
207
|
-
showtime
|
|
208
|
-
showtime
|
|
209
|
-
showtime labels # Reference complete label system
|
|
202
|
+
showtime sync PR_NUMBER --check-only # Determine build_needed + target_sha
|
|
203
|
+
showtime sync PR_NUMBER --sha SHA # Execute atomic claim + build + deploy
|
|
210
204
|
```
|
|
211
205
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
**1. Install GitHub workflows:**
|
|
215
|
-
Copy `workflows-reference/showtime-trigger.yml` and `workflows-reference/showtime-cleanup.yml` to Superset's `.github/workflows/`.
|
|
216
|
-
|
|
217
|
-
**2. Configure secrets (already exist in Superset):**
|
|
218
|
-
- `AWS_ACCESS_KEY_ID`
|
|
219
|
-
- `AWS_SECRET_ACCESS_KEY`
|
|
220
|
-
- `GITHUB_TOKEN`
|
|
221
|
-
|
|
222
|
-
**3. Dependencies:**
|
|
223
|
-
Showtime coordinates with Superset's existing build infrastructure - no additional setup needed.
|
|
224
|
-
|
|
225
|
-
## 📊 CLI Reference (For Development/Debugging)
|
|
206
|
+
## 🛠️ CLI Usage
|
|
226
207
|
|
|
227
|
-
|
|
208
|
+
The CLI is primarily used by GitHub Actions, but available for debugging and advanced users:
|
|
228
209
|
|
|
229
|
-
### Debugging Commands
|
|
230
210
|
```bash
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
showtime
|
|
234
|
-
showtime test-lifecycle 1234 # Full workflow simulation
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Manual Operations (Advanced)
|
|
238
|
-
```bash
|
|
239
|
-
showtime start 1234 # Manually create environment
|
|
240
|
-
showtime start 1234 --sha abc123f # Create environment (specific SHA)
|
|
241
|
-
showtime stop 1234 # Manually delete environment
|
|
242
|
-
showtime sync 1234 # Force sync to desired state
|
|
243
|
-
showtime cleanup --respect-ttl # Manual cleanup
|
|
211
|
+
pip install superset-showtime
|
|
212
|
+
export GITHUB_TOKEN=your_token
|
|
213
|
+
showtime --help # See all available commands
|
|
244
214
|
```
|
|
245
215
|
|
|
246
|
-
### GitHub Actions Commands
|
|
247
|
-
```bash
|
|
248
|
-
showtime handle-trigger 1234 # Process trigger labels (called by GHA)
|
|
249
|
-
showtime cleanup --older-than 48h # Scheduled cleanup (called by GHA)
|
|
250
|
-
```
|
|
251
216
|
|
|
252
|
-
## 🎪 Benefits for Superset
|
|
253
|
-
|
|
254
|
-
### For Contributors
|
|
255
|
-
- **🎯 Simple workflow** - Just add/remove GitHub labels
|
|
256
|
-
- **👀 Visual feedback** - See environment status in PR labels
|
|
257
|
-
- **⚡ Automatic updates** - New commits update environments automatically
|
|
258
|
-
- **🔧 Configuration testing** - Test config changes through code commits
|
|
259
|
-
|
|
260
|
-
### For Maintainers
|
|
261
|
-
- **📊 Complete visibility** - `showtime list` shows all environments
|
|
262
|
-
- **🧹 Easy cleanup** - Automatic expired environment cleanup
|
|
263
|
-
- **🔍 Better debugging** - Clear state in labels, comprehensive CLI
|
|
264
|
-
- **💰 Cost savings** - No duplicate environments, proper cleanup
|
|
265
|
-
|
|
266
|
-
### For Operations
|
|
267
|
-
- **📝 Simpler workflows** - Replace complex GHA scripts with simple CLI calls
|
|
268
|
-
- **🔒 Same security model** - No new permissions needed
|
|
269
|
-
- **🎯 Deterministic** - Predictable AWS resource naming
|
|
270
|
-
- **🚨 Monitoring ready** - 48h maximum lifetime, scheduled cleanup
|
|
271
|
-
|
|
272
|
-
## 🏗️ Architecture
|
|
273
|
-
|
|
274
|
-
### State Management
|
|
275
|
-
All state lives in **GitHub labels** - no external databases needed:
|
|
276
|
-
- **Trigger labels** (`🎪 trigger-*`) - Commands that get processed and removed
|
|
277
|
-
- **State labels** (`🎪 🚦 *`) - Current environment status, managed by CLI
|
|
278
|
-
|
|
279
|
-
### AWS Resources
|
|
280
|
-
Deterministic naming enables reliable cleanup:
|
|
281
|
-
- **ECS Service:** `pr-{pr_number}-{sha}` (e.g., `pr-1234-abc123f`)
|
|
282
|
-
- **ECR Image:** `pr-{pr_number}-{sha}-ci` (e.g., `pr-1234-abc123f-ci`)
|
|
283
|
-
|
|
284
|
-
### Rolling Updates
|
|
285
|
-
Zero-downtime updates by running multiple environments:
|
|
286
|
-
1. Keep old environment serving traffic
|
|
287
|
-
2. Build new environment in parallel
|
|
288
|
-
3. Switch traffic when new environment is healthy
|
|
289
|
-
4. Clean up old environment
|
|
290
217
|
|
|
291
218
|
## 🤝 Contributing
|
|
292
219
|
|