Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve hack scripts #463

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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