Skip to content

Commit

Permalink
fix: improve hack scripts
Browse files Browse the repository at this point in the history
- reset.sh: add '--all' flag
- reset.sh: remove the '-i dh' option as DH can now be reset with
  '-n rhtap-dh'
- reset.sh: delete PVCs on namespace deletion
- fix a small issue with the ENVFILE var

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
Roming22 committed Feb 14, 2025
1 parent dfb5a19 commit 8809324
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion hack/ci-set-org-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-e | --env-file)
ENVFILE="$2"
ENVFILE="$(readlink -e "$2")"
shift
;;
-n | --namespace)
Expand Down
2 changes: 1 addition & 1 deletion hack/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ parse_args() {
shift
;;
-e | --env-file)
ENVFILE="$2"
ENVFILE="$(readlink -e "$2")"
shift
;;
-i|--integration)
Expand Down
24 changes: 10 additions & 14 deletions hack/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Usage:
${0##*/} [options]
Optional arguments:
-a, --all
Reset the cluster and integration services.
-c, --cluster
Reset all RHTAP namespaces in the cluster.
-e, --env-file
Expand All @@ -26,7 +28,7 @@ Optional arguments:
Delete the specified namespace. The option can be repeated
to delete multiple namespaces.
-i, --integration INTEGRATION
Service to reset [dh, github, gitlab]. The option can be repeated
Service to reset [github, gitlab]. The option can be repeated
to reset multiple services.
-d, --debug
Activate tracing/debug mode.
Expand All @@ -43,20 +45,20 @@ parse_args() {
NAMESPACES=()
while [[ $# -gt 0 ]]; do
case $1 in
-a|--all)
CLUSTER=1
GITHUB=1
GITLAB=1
;;
-c|--cluster)
CLUSTER=1
;;
-e | --env-file)
ENVFILE="$2"
ENVFILE="$(readlink -e "$2")"
shift
;;
-i|--integration)
case $2 in
dh)
if kubectl get backstages.rhdh.redhat.com --ignore-not-found 2>/dev/null; then
DH=1
fi
;;
github)
GITHUB=1
;;
Expand Down Expand Up @@ -120,7 +122,7 @@ action() {
for ns in "${NAMESPACES[@]}"; do
kubectl delete namespace "$ns" &
echo "Deleting namespace $ns..."
for cr in "applications.argoproj.io" "kafkatopics.kafka.strimzi.io"; do
for cr in "applications.argoproj.io" "kafkatopics.kafka.strimzi.io" "persistentvolumeclaims"; do
sleep 3
while [ "$(oc get "$cr" -n "$ns" -o name | wc -l)" != "0" ]; do
for kt in $(oc get "$cr" -n "$ns" -o name); do
Expand All @@ -133,12 +135,6 @@ action() {
echo "✓ Deleted all namespaces"
echo
fi
if [ -n "${DH:-}" ]; then
echo '# Developer Hub'
kubectl delete backstages.rhdh.redhat.com -n "$NAMESPACE" developer-hub --ignore-not-found --wait=true
kubectl delete persistentvolumeclaims -n "$NAMESPACE" data-backstage-psql-developer-hub-0 --ignore-not-found --wait=true
echo
fi
if [ -n "${GITHUB:-}" ]; then
echo '# GitHub'
for REPO in $(gh repo list "$GITHUB__ORG" --json url | yq '.[].url'); do
Expand Down

0 comments on commit 8809324

Please sign in to comment.