Code Review
/
releng
/
global-jjb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Feat: Allow use of newer JDKs for Sonar scans
[releng/global-jjb.git]
/
shell
/
openstack-cleanup-orphaned-stacks.sh
diff --git
a/shell/openstack-cleanup-orphaned-stacks.sh
b/shell/openstack-cleanup-orphaned-stacks.sh
index
8f1851e
..
e4f457a
100644
(file)
--- a/
shell/openstack-cleanup-orphaned-stacks.sh
+++ b/
shell/openstack-cleanup-orphaned-stacks.sh
@@
-22,10
+22,19
@@
stack_in_jenkins() {
builds=()
for jenkins in "${@:2}"; do
builds=()
for jenkins in "${@:2}"; do
- JENKINS_URL="$jenkins/computer/api/json?tree=computer[executors[currentExecutable[url]],oneOffExecutors[currentExecutable[url]]]&xpath=//url&wrapper=builds"
+ PARAMS="tree=computer[executors[currentExecutable[url]],"
+ PARAMS=$PARAMS"oneOffExecutors[currentExecutable[url]]]"
+ PARAMS=$PARAMS"&xpath=//url&wrapper=builds"
+ JENKINS_URL="$jenkins/computer/api/json?$PARAMS"
resp=$(curl -s -w "\\n\\n%{http_code}" --globoff -H "Content-Type:application/json" "$JENKINS_URL")
json_data=$(echo "$resp" | head -n1)
resp=$(curl -s -w "\\n\\n%{http_code}" --globoff -H "Content-Type:application/json" "$JENKINS_URL")
json_data=$(echo "$resp" | head -n1)
- #status=$(echo "$resp" | awk 'END {print $NF}')
+ status=$(echo "$resp" | awk 'END {print $NF}')
+
+ if [ "$status" != 200 ]; then
+ >&2 echo "ERROR: Failed to fetch data from $JENKINS_URL with status code $status"
+ >&2 echo "$resp"
+ exit 1
+ fi
if [[ "${jenkins}" == *"jenkins."*".org" ]] || [[ "${jenkins}" == *"jenkins."*".io" ]]; then
silo="production"
if [[ "${jenkins}" == *"jenkins."*".org" ]] || [[ "${jenkins}" == *"jenkins."*".io" ]]; then
silo="production"
@@
-81,6
+90,6
@@
for STACK_NAME in "${OS_STACKS[@]}"; do
continue
else
echo "Deleting orphaned stack: $STACK_NAME"
continue
else
echo "Deleting orphaned stack: $STACK_NAME"
- lftools openstack --os-cloud "$os_cloud" stack delete "$STACK_NAME"
+ lftools openstack --os-cloud "$os_cloud" stack delete
--force
"$STACK_NAME"
fi
done
fi
done