feat(cli): add Python stackctl with overlays and SOPS; wrap bash script#322
Open
wax911 wants to merge 9 commits into
Open
feat(cli): add Python stackctl with overlays and SOPS; wrap bash script#322wax911 wants to merge 9 commits into
wax911 wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive Python-based replacement for the existing bash stackctl.sh script, adding support for environment overlays, SOPS-based secret management, and improved CLI functionality. The changes modernize the stack management workflow while maintaining backward compatibility through a bash wrapper.
Key changes:
- New Python CLI (
tools/stackctl_cli.py) with enhanced features including environment overlays and SOPS integration - Bash script converted to compatibility wrapper that maps legacy flags to Python CLI
- SOPS configuration moved from tracked
.sops.yamlto example file to encourage local customization
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/stackctl_cli.py | New Python CLI implementation with commands for render, deploy, logs, env management, secrets handling, and doctor checks |
| tools/requirements.txt | Added Python dependencies (typer, rich, mergedeep) for the new CLI |
| stackctl.sh | Converted from full implementation to compatibility wrapper delegating to Python CLI |
| .sops.yaml.example | Example SOPS configuration file for users to customize locally |
| .sops.yaml | Removed tracked SOPS configuration to prevent accidental key exposure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
fbacd96 to
4c97b9b
Compare
Member
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
- Add tools/stackctl_cli.py with commands: render, deploy (--follow-logs), down, status, logs, env, secrets (encrypt/decrypt), doctor run - Support environment overlays via environments/<env>/<stack>.overlay.yml (deep-merge) - Reuse tools/render_compose.py for per-service env interpolation and absolutized paths - Replace bash stackctl.sh with wrapper delegating to Python CLI and mapping legacy flags (e.g., --no-logs -> --no-follow-logs) - Add .sops.yaml.example and remove tracked .sops.yaml to encourage local policy and encrypted files in VCS - Update tools/requirements.txt (typer, rich, mergedeep) - Expand .gitignore for Python/virtualenv/VS Code and ensure .env is ignored
…to deploy
- Treat no-command ("") as a request for --help (do not implicitly run deploy)
- Print explicit ERROR for unknown commands and display help
- Remove legacy fallback behavior in stackctl.sh compatibility wrapper
…ements - Add environments/local overlays for infrastructure and observability - Add pytest test for deep-merge overlay behavior - Update tools/requirements.txt to include pytest
- Add placeholder apisix/api-gateway/.env.example.enc.yaml - Add docs/SOPS-usage.md with examples for local encrypt/decrypt
- Add docs/SOPS-usage.md and example encrypted file for apisix api-gateway
Introduce run_py and check_py_cli helpers and centralize all python3 calls through run_py. Add info/warn/die helpers and improved error messages. Add a bootstrap command that: - copies .env.example -> .env when missing - installs tools/requirements.txt into active venv (warn if no venv) - checks Docker presence and Docker Swarm state, with guidance Also keep legacy flag mappings for deploy and ensure help is shown for empty/unknown commands.
Introduce a "Bootstrap (developer setup)" section showing ./stackctl.sh --bootstrap and what it does: - copies missing .env files from .env.example - installs Python requirements when a virtualenv is active - checks Docker installation and Docker Swarm status Notes that the helper is a safe convenience (won't overwrite or commit .env files) and links to tools/README.md for more details.
…g, unused var (#374) * Initial plan * fix(cli): address PR review comments - cross-platform time, formatting, unused var Co-authored-by: wax911 <7859175+wax911@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wax911 <7859175+wax911@users.noreply.github.com>
1de7bd0 to
c8b1656
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add tools/stackctl_cli.py with commands: render, deploy (--follow-logs), down, status, logs, env, secrets (encrypt/decrypt), doctor run
Support environment overlays via environments//.overlay.yml (deep-merge)
Reuse tools/render_compose.py for per-service env interpolation and absolutized paths
Replace bash stackctl.sh with wrapper delegating to Python CLI and mapping legacy flags (e.g., --no-logs -> --no-follow-logs)
Add .sops.yaml.example and remove tracked .sops.yaml to encourage local policy and encrypted files in VCS
Update tools/requirements.txt (typer, rich, mergedeep)
Expand .gitignore for Python/virtualenv/VS Code and ensure .env is ignored