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.

Files changed (31) hide show
  1. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/.claude/settings.local.json +5 -1
  2. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/CLAUDE.md +67 -36
  3. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/PKG-INFO +42 -115
  4. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/README.md +41 -114
  5. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/__init__.py +1 -1
  6. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/cli.py +410 -56
  7. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/circus.py +11 -1
  8. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/github_messages.py +11 -1
  9. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/workflows-reference/showtime-trigger.yml +28 -59
  10. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/.gitignore +0 -0
  11. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/.pre-commit-config.yaml +0 -0
  12. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/Makefile +0 -0
  13. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/dev-setup.sh +0 -0
  14. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/pypi-push.sh +0 -0
  15. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/pyproject.toml +0 -0
  16. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/requirements-dev.txt +0 -0
  17. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/requirements.txt +0 -0
  18. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/__main__.py +0 -0
  19. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/commands/__init__.py +0 -0
  20. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/commands/start.py +0 -0
  21. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/__init__.py +0 -0
  22. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/aws.py +0 -0
  23. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/emojis.py +0 -0
  24. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/github.py +0 -0
  25. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/core/label_colors.py +0 -0
  26. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/showtime/data/ecs-task-definition.json +0 -0
  27. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/tests/__init__.py +0 -0
  28. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/tests/unit/__init__.py +0 -0
  29. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/tests/unit/test_circus.py +0 -0
  30. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/uv.lock +0 -0
  31. {superset_showtime-0.2.8 → superset_showtime-0.3.1}/workflows-reference/showtime-cleanup.yml +0 -0
@@ -30,7 +30,11 @@
30
30
  "Bash(git grep:*)",
31
31
  "Bash(git push:*)",
32
32
  "Bash(make lint:*)",
33
- "Bash(mypy:*)"
33
+ "Bash(mypy:*)",
34
+ "Bash(sed:*)",
35
+ "Bash(git pull:*)",
36
+ "Bash(git rebase:*)",
37
+ "Bash(git fetch:*)"
34
38
  ],
35
39
  "deny": [],
36
40
  "ask": []
@@ -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 replaces complex GitHub Actions scripts with a simple CLI that uses GitHub labels for ACID-like state transactions.
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 with real GitHub PRs safely
25
+ # Test new unified sync command
26
26
  export GITHUB_TOKEN=xxx
27
- showtime start 34809 --dry-run-aws --aws-sleep 5 # Mock AWS, real GitHub labels
28
- showtime status 34809 # Check environment status
29
- showtime stop 34809 --force # Clean up test labels
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 state machine**:
43
- - **Trigger labels** (`🎪 trigger-start`) - Commands added by users, processed and removed by CLI
44
- - **State labels** (`🎪 🚦 abc123f running`) - Per-SHA status managed by CLI
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 handle-trigger {pr-number}` - Process trigger labels
100
- - `showtime handle-sync {pr-number}` - Handle new commits
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
- Must maintain compatibility with existing Superset infrastructure:
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
- ### Label Operations Must Be Atomic
137
- GitHub label operations are the "database transactions" - handle carefully:
154
+ ### ACID-Style Atomic Transactions
155
+ GitHub label operations implement compare-and-swap pattern for race condition prevention:
138
156
  ```python
139
- # Remove trigger immediately after processing
140
- github.remove_label(pr_number, trigger_label)
141
- # Update state labels atomically
142
- github.remove_circus_labels(pr_number)
143
- for label in new_labels:
144
- github.add_label(pr_number, label)
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
- ### ✅ Fully Implemented (Production Ready)
170
- - **Blue-green deployment**: Zero-downtime updates with health checks
171
- - **AWS integration**: Complete ECS/ECR operations with DockerHub pulling
172
- - **Smart sync system**: Intelligent PR state detection and auto-sync
173
- - **GitHub Actions workflows**: Drop-in replacement for ephemeral-env.yml
174
- - **TTL-based cleanup**: Respects individual environment preferences
175
- - **SHA override support**: Deploy any specific commit for testing
176
- - **Freeze functionality**: Pin environments during testing
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
- ### 📦 Ready for Deployment
187
- - **GitHub Actions**: `workflows-reference/showtime-trigger.yml` + `showtime-cleanup.yml`
188
- - **PyPI package**: Built with dependencies, ready for `pip install superset-showtime`
189
- - **Testing infrastructure**: Comprehensive dry-run and manual testing support
190
- - **Documentation**: Complete README with workflows and examples
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.2.8
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
- ## 📊 For Maintainers (CLI Operations)
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
- Showtime is designed to be called by Superset's GitHub Actions workflows:
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
- **Install CLI for debugging/testing:**
265
- ```bash
266
- pip install superset-showtime
267
- export GITHUB_TOKEN=your_personal_access_token
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
- **Manual operations:**
265
+ **Commands used:**
271
266
  ```bash
272
- showtime list # Monitor all active environments
273
- showtime status 1234 # Debug specific environment
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
- ### For Repository Integration (GitHub Actions)
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
- > **Primary Interface**: Use GitHub labels in PR interface. CLI is mainly for maintainers debugging or developing Showtime itself.
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
- showtime list # Monitor all environments
297
- showtime status 1234 # Debug specific environment
298
- showtime labels # Complete label reference
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
- ## 📊 For Maintainers (CLI Operations)
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
- Showtime is designed to be called by Superset's GitHub Actions workflows:
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
- **Install CLI for debugging/testing:**
200
- ```bash
201
- pip install superset-showtime
202
- export GITHUB_TOKEN=your_personal_access_token
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
- **Manual operations:**
200
+ **Commands used:**
206
201
  ```bash
207
- showtime list # Monitor all active environments
208
- showtime status 1234 # Debug specific environment
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
- ### For Repository Integration (GitHub Actions)
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
- > **Primary Interface**: Use GitHub labels in PR interface. CLI is mainly for maintainers debugging or developing Showtime itself.
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
- showtime list # Monitor all environments
232
- showtime status 1234 # Debug specific environment
233
- showtime labels # Complete label reference
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
 
@@ -4,7 +4,7 @@
4
4
  Circus tent emoji state tracking for Apache Superset ephemeral environments.
5
5
  """
6
6
 
7
- __version__ = "0.2.8"
7
+ __version__ = "0.3.1"
8
8
  __author__ = "Maxime Beauchemin"
9
9
  __email__ = "maximebeauchemin@gmail.com"
10
10