Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
klhftco authored Nov 20, 2024
1 parent ee4afe7 commit 2b230fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ jobs:
set -e # Exit immediately if a command fails
# Get bt-dev-app- deployments sorted by creation timestamp
deployments=$(helm list -d \
deployments=$(helm list \
--namespace=bt \
-o json | jq -r '.[] | [.name, .updated] | @tsv' | grep '^bt-dev-app') || true
--date \
--short | grep '^bt-dev-app') || true
deployment_count=$(echo "$deployments" | wc -l)
# Check if deployment count > 8
if [ "$deployment_count" -gt 8 ]; then
echo "Too many deployments. Deleting the oldest deployment."
# Get oldest deployment from first line of deployments
oldest_deployment=$(echo "$deployments" | head -n 1 | grep -o '^bt-dev-app-[a-f0-9]\{7\}')
oldest_deployment=$(echo "$deployments" | head -n 1)
# Uninstall deployment
helm uninstall "${oldest_deployment}"
Expand Down

0 comments on commit 2b230fd

Please sign in to comment.