Modern ephemeral environment management for Apache Superset using circus tent emoji labels
Superset Showtime is a CLI tool designed primarily for GitHub Actions to manage Apache Superset ephemeral environments. It uses circus tent emoji labels as a visual state management system and depends on Superset's existing build infrastructure.
Create an ephemeral environment:
- Go to your PR in GitHub
- Add label:
πͺ β‘ showtime-trigger-start - Watch the magic happen - labels will update automatically
- When you see
πͺ π¦ {sha} running, your environment is ready! - Get URL from
πͺ π {sha} {ip}βhttp://{ip}:8080 - Every new commit can deploy a fresh environment while the prior SHA remains available until promotion succeeds
To test a specific commit without auto-updates:
- Add label:
πͺ π§ showtime-freeze(prevents auto-sync on new commits)
Clean up when done:
# Add this label:
πͺ π showtime-trigger-stop
# Labels disappear only after AWS deletion is confirmedπͺ GitHub labels become a visual state machine:
# User adds trigger label in GitHub UI:
πͺ β‘ showtime-trigger-start
# System responds with state labels:
πͺ abc123f π¦ building # Environment abc123f is building
πͺ π― abc123f # abc123f is the active environment
πͺ abc123f π
2024-01-15T14-30 # Created timestamp
πͺ abc123f β 24h # Time-to-live policy
πͺ abc123f π€‘ maxime # Requested by maxime (clown emoji!)
# When ready:
πͺ abc123f π¦ running # Environment is now running
πͺ abc123f π 52-1-2-3 # Available at http://52.1.2.3:8080flowchart TD
A[User adds πͺ β‘ trigger-start] --> B[GitHub Actions: sync]
B --> C{Current state?}
C -->|No environment| D[π Claim: Remove trigger + Set building]
C -->|Running + new SHA| E[π Claim: Remove trigger + Set building]
C -->|Already building| F[β Exit: Another job active]
C -->|No triggers| G[β Exit: Nothing to do]
D --> H[π State: building]
E --> H
H --> I[π³ Docker build + immutable digest]
I -->|Success| S{Runner smoke enabled?}
S -->|Yes| T[Local /health smoke + owned cleanup]
S -->|No| J[π State: built]
T -->|Healthy and cleaned| J
T -->|Failure| K
I -->|Fail| K[π State: failed]
J --> L[π State: deploying]
L --> M[βοΈ AWS Deploy]
M -->|Success| N[π State: running]
M -->|Fail| O[π State: failed]
N --> P[πͺ Environment ready!]
Q[User adds πͺ π trigger-stop] --> R[π§Ή Cleanup AWS + Remove labels]
Install CLI for debugging:
pip install superset-showtime
export GITHUB_TOKEN=your_tokenMonitor and debug:
showtime list # See all active environments
showtime status 1234 # Debug specific environment
showtime labels # Complete label referenceTesting/development:
showtime sync 1234 --dry-run-aws --dry-run-docker # Test without costs
showtime sync 1234 --dry-run-github # Read GitHub state without writes
showtime cleanup --dry-run --older-than 1h # Test environment + label cleanup
showtime cleanup-labels # Preview stale repo label definitionsArchitecture: GitHub label writes and AWS operations are not transactional. Showtime preserves the previous environment during a different-SHA deployment and records partial cleanup so serialized retries can converge safely. Callers must serialize operations for each PR; there is no distributed global lock.
| Label | Action | Result |
|---|---|---|
πͺ β‘ showtime-trigger-start |
Create environment | Builds and deploys ephemeral environment with blue-green deployment |
πͺ π showtime-trigger-stop |
Destroy environment | Removes resource labels only after confirmed AWS deletion |
πͺ π§ showtime-freeze |
Freeze environment | Prevents auto-sync on new commits (for testing specific SHAs) |
| Label Pattern | Meaning | Example |
|---|---|---|
πͺ {sha} π¦ {status} |
Environment status | πͺ abc123f π¦ running |
πͺ π― {sha} |
Active environment pointer | πͺ π― abc123f |
πͺ ποΈ {sha} |
Building environment pointer | πͺ ποΈ def456a |
πͺ {sha} π
{timestamp} |
Creation time | πͺ abc123f π
2024-01-15T14-30 |
πͺ {sha} π {ip:port} |
Environment URL | πͺ abc123f π 52.1.2.3:8080 |
πͺ {sha} β {ttl} |
Time-to-live policy | πͺ abc123f β 24h |
πͺ {sha} π€‘ {username} |
Who requested | πͺ abc123f π€‘ maxime |
πͺ {sha} 𧬠{fingerprint} |
Task-definition ownership used for guarded cleanup | πͺ abc123f 𧬠0123456789abcdef0123456789abcdef |
πͺ {sha} π§Ή cleanup-pending |
AWS deletion is unconfirmed and tracking must remain | πͺ abc123f π§Ή cleanup-pending |
Approach: Modify configuration directly in your PR code, then trigger environment.
Workflow:
- Modify
superset_config.pywith your changes - Push commit β Creates new SHA (e.g.,
def456a) - Add
πͺ β‘ showtime-trigger-startβ Deploys with your config - Test environment reflects your exact code changes
This approach creates traceable, reviewable changes that are part of your git history.
- Add trigger label in GitHub UI:
πͺ β‘ showtime-trigger-start - Watch state labels appear:
πͺ abc123f π¦ building β Environment is building πͺ π― abc123f β This is the active environment πͺ abc123f π 2024-01-15T14-30 β Started building at this time - Wait for completion:
πͺ abc123f π¦ running β Now ready! πͺ abc123f π 52.1.2.3:8080 β Visit http://52.1.2.3:8080
- Add freeze label:
πͺ π§ showtime-freeze - Result: Environment won't auto-update on new commits
- Use case: Test specific SHA while continuing development
- Override: Add
πͺ β‘ showtime-trigger-startto force update despite freeze
When you push new commits, Showtime automatically:
- Detects new commit via GitHub webhook
- Builds new environment alongside old one
- Switches traffic when new environment is ready
- Cleans up old environment
You'll see:
# During update:
πͺ abc123f π¦ running # Old environment still serving
πͺ def456a π¦ building # New environment building
πͺ π― abc123f # Traffic still on old
πͺ ποΈ def456a # New one being prepared
# After update:
πͺ def456a π¦ running # New environment live
πͺ π― def456a # Traffic switched
πͺ def456a π 52-4-5-6 # New IP address
# abc123f labels are removed after its AWS deletion is confirmedThe cross-SHA flow promotes the candidate only after deployment succeeds. A failed candidate does not move the active pointer or delete the prior healthy service. Cleanup removes labels only after service absence is confirmed; false returns, exceptions, ownership mismatches, and uncertain AWS responses retain tracking and make the CLI exit nonzero.
An explicit rebuild of the same SHA is different: service names are deterministic, so it destructively reuses that service identity and has no fallback environment. Showtime warns before this path. Per-PR operations must remain serialized. GitHub label writes can still be partially applied, and a later sync reconciles the active pointer without rebuilding a candidate that is already marked running.
Per-PR teardown only detaches labels. Repository-wide label definitions may be
shared by other PRs and are deleted exclusively by cleanup-labels after a global
attachment-count check.
start and sync accept --startup-timeout-seconds, or
SHOWTIME_STARTUP_TIMEOUT_SECONDS. The default is 1800 seconds (30 minutes);
values must be positive integers and are validated before deployment changes.
showtime sync PR_NUMBER --sha SHA --startup-timeout-seconds 1800After task-definition registration and any required same-SHA teardown, one
monotonic startup budget covers dedicated client setup, service creation, update,
task observation, networking, and HTTP health checks. Task
replacement does not reset it. Success requires the expected task definition,
one stable primary deployment with matching running/desired counts and no
pending tasks, and /health returning HTTP 200 from that deployment's running
task. An incomplete or failed rollout cannot pass just because HTTP responds;
there is no homepage or redirect fallback.
Showtime reports task, endpoint, and service-state changes while waiting. A stopped task can be replaced within the original budget. Failed rollouts and terminal service states fail promptly. Newly created service/task/network identities get a bounded visibility allowance of up to five minutes, constrained by the original deadline; permission errors are not treated as visibility delays. Historical task records cannot establish current readiness, and historical scans do not delay a candidate that has already passed strict health. After a failed probe, historical collection has a 15-second per-cycle cap and reserves time for the next live poll; incomplete history is reported as partial evidence.
Startup AWS requests use 2-second connect and 5-second read timeouts with SDK retries disabled. HTTP uses a streaming response and finite timeouts without reading the body. A request is not started with less than its 7-second transport allowance remaining. These are practical request bounds, not an unconditional process kill: DNS, credential providers, and OS scheduling can affect elapsed time. The longer default is a mitigation, not a diagnosis of slow application startup.
Before failed-candidate cleanup, Showtime collects bounded service/task evidence,
including exit codes, stop reasons, replacements, and recent service events.
An additional 30-second diagnostic budget permits at most one CloudWatch log
page (100 events), with log content limited to 100 lines and 16 KiB. Log access
uses the packaged ECS log configuration and requires optional logs:GetLogEvents
permission on that log group. Available, empty, denied, unavailable, and
not-attempted logs are reported distinctly. Known configured secret values are
redacted; raw task environments and AWS exception payloads are not printed.
Diagnostic failures cannot suppress candidate cleanup or erase the primary
failure. Total command time can exceed the startup budget by this diagnostic
allowance and the existing bounded cleanup waits.
start and sync expose a local pre-deployment smoke test. It is off by
default and can be enabled with --smoke-test or SHOWTIME_SMOKE_TEST=true.
The managed path builds and pushes linux/amd64, reads Buildx's manifest
digest, then uses that exact apache/superset@sha256:... reference for both
the smoke container and ECS task definition. Missing or malformed digest
metadata stops before smoke or AWS.
showtime sync PR_NUMBER --smoke-test \
--build-timeout-seconds 3600 \
--smoke-timeout-seconds 600 \
--smoke-diagnostics-dir .showtime/diagnosticsEnvironment equivalents are SHOWTIME_BUILD_TIMEOUT_SECONDS,
SHOWTIME_SMOKE_TIMEOUT_SECONDS, and SHOWTIME_SMOKE_DIAGNOSTICS_DIR.
Timeouts must be positive integers. The diagnostics path must be writable and
must not use symlinked directories. The reference Actions job allows 120 minutes;
adjust its job timeout when changing the build, smoke, ECS, or cleanup budgets.
The disposable container is rendered from the packaged ECS task definition,
including effective feature flags, entrypoint, command, container port, 0.5
CPU, and 2 GiB memory with swap capped at the same value. Its port is published
only on 127.0.0.1 with an ephemeral host port. Environment values are written
to a mode-0600 temporary env file, never command arguments, and the file is
deleted immediately after create. Success requires /health HTTP 200 and
verified removal of the randomly named, ownership-labelled container before
any AWS allocation. ECS readiness remains mandatory afterward.
Build output, Docker errors, and retained logs use the same redaction rules
and finite buffers. On smoke failure Showtime writes unique mode-0600
runner-smoke-pr-<pr>-<sha>-<attempt>.json and .log files. JSON contains only
the primary outcome, selected container state, mapped port, immutable image,
log status, cleanup result, and secondary evidence errors. Log status is one
of captured_nonempty, captured_empty, unavailable, or not_attempted;
logs are limited to 100 lines and 16 KiB. Process output retention is limited
to 64 KiB. Docker commands have 30-second execution budgets, HTTP requests have seven-second
request envelopes, and diagnostic and cleanup work have separate 30-second budgets.
Subprocess shutdown can add up to seven seconds for TERM/KILL handling. Handled SIGINT
and SIGTERM trigger bounded evidence and owned cleanup; SIGKILL cannot be
cleaned up by the process.
Showtime creates local diagnostic files but does not upload them. Every
consuming workflow must add an if: always() actions/upload-artifact@v4
step with include-hidden-files: true and the narrow path
.showtime/diagnostics/runner-smoke-*; do not upload .showtime/ wholesale.
See workflows-reference/showtime-trigger.yml for the default-off example.
The smoke check approximates packaged startup and resource limits. It does not
reproduce Fargate networking, scheduling, or logging, does not establish the
unknown incident cause, and never replaces strict ECS readiness. Fully mocked
testing remains available with both --dry-run-docker --dry-run-aws; skipping
Docker is rejected with live AWS or with smoke enabled because neither can
prove immutable identity.
- β Superset maintainers (with write access) can add trigger labels
- β External contributors cannot trigger environments (no write access to add labels)
- π Secure by design - only trusted users can create expensive AWS resources
π― Live Workflow: showtime-trigger.yml
How it works:
- Triggers on PR label changes, commits, and closures
- Installs
superset-showtimefrom PyPI (trusted code, not PR code) - Runs
showtime syncto handle trigger processing and deployments - Supports manual testing via
workflow_dispatchwith specific SHA override
Commands used:
showtime sync PR_NUMBER --check-only # Read-only: determine build_needed + target_sha
showtime sync PR_NUMBER --sha SHA # Execute atomic claim + build + deployThe CLI is primarily used by GitHub Actions, but available for debugging and advanced users:
pip install superset-showtime
export GITHUB_TOKEN=your_token
# Core commands:
showtime sync PR_NUMBER # Sync to desired state (main command)
showtime start PR_NUMBER # Create new environment
showtime stop PR_NUMBER # Delete environment
showtime status PR_NUMBER # Show current state
showtime list # List all environments
showtime cleanup --older-than 48h --force # Clean up expired envs, closed PR labels, and stale labels
showtime cleanup-labels --no-dry-run --force # Prune unattached per-SHA labels onlyTest with real PRs safely:
# Test full workflow without costs:
showtime sync YOUR_PR_NUMBER --dry-run-aws --dry-run-docker
# Test cleanup logic:
showtime cleanup --dry-run --older-than 24h
showtime cleanup-labels # dry-run by defaultgit clone https://github.com/mistercrunch/superset-showtime
cd superset-showtime
# Using uv (recommended):
uv pip install -e ".[dev]"
make pre-commit
make test
# Traditional pip:
pip install -e ".[dev]"
pre-commit install
pytestApache License 2.0 - same as Apache Superset.
πͺ "Ladies and gentlemen, welcome to Superset Showtime - where ephemeral environments are always under the big top!" πͺπ€‘β¨