https://github.com/opszero/actions-deploytag-cleanup
https://github.com/opszero/actions-deploytag-cleanup
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/opszero/actions-deploytag-cleanup
- Owner: opszero
- License: other
- Created: 2022-09-10T20:36:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-11-07T04:56:30.000Z (3 months ago)
- Last Synced: 2025-11-07T06:18:34.364Z (3 months ago)
- Homepage: https://www.opszero.com
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# actions-deploytag-cleanup
# Prune Environments in Helm Scaffold
```python
#!/usr/bin/env python3
import subprocess
subprocess.getoutput("git remote update")
deployed_branches = subprocess.getoutput("helm list -a -A 2>&1 | grep feature-deploy | awk '{print $2}'").split("\n")
active_branches = subprocess.getoutput("git branch -r | grep feature_deploy | sed -e 's|^ origin/||g' | sed -e 's/[^A-Za-z0-9]/-/g'").split("\n")
APP = "appname"
for branch in deployed_branches:
if branch not in active_branches:
subprocess.run(f"KUBECONFIG=./kubeconfig helm delete --wait -n {branch} {APP}", shell=True)
subprocess.run(f"KUBECONFIG=./kubeconfig kubectl delete namespace -n {branch}", shell=True)