File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
ci/images/ci-runner/hack/bin Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,10 @@ is_cluster_expired() {
24
24
}
25
25
26
26
destroy_expired_clusters () {
27
+ expired_clusters=()
27
28
mapfile -t clusters < <( rosa list clusters --region " $REGION " | grep " ready" | awk ' {print $2}' )
28
29
30
+ echo " [$( date +" %Y/%m/%d %H:%M:%S" ) ] Cluster count: ${# clusters[@]} "
29
31
for cluster in " ${clusters[@]} " ; do
30
32
if [[ " ${EXCLUDE_CLUSTER[*]} " =~ $cluster ]]; then
31
33
continue
@@ -34,13 +36,21 @@ destroy_expired_clusters() {
34
36
is_expired=$( is_cluster_expired " $cluster " )
35
37
36
38
if [[ " $is_expired " == " true" ]]; then
37
- export CLUSTER_NAME=" $cluster "
38
- " $SCRIPT_DIR " /destroy-cluster.sh
39
+ expired_clusters+=( " $cluster " )
39
40
fi
40
41
done
42
+
43
+ echo " [$( date +" %Y/%m/%d %H:%M:%S" ) ] Expired cluster count: ${# expired_clusters[@]} "
44
+ count=0
45
+ for cluster in " ${expired_clusters[@]} " ; do
46
+ count=$(( count + 1 ))
47
+ echo " Destroying $cluster [$count /${# expired_clusters[@]} ]"
48
+ export CLUSTER_NAME=" $cluster "
49
+ " $SCRIPT_DIR " /destroy-cluster.sh
50
+ done
41
51
}
42
52
43
53
setx_off
44
54
rosa login --token=" $ROSA_TOKEN "
45
55
setx_on
46
- destroy_expired_clusters
56
+ destroy_expired_clusters
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ if [ -e "$failure_file" ]; then
17
17
echo " Delete '$failure_file ' within 15 minutes to keep the cluster alive for investigation."
18
18
echo
19
19
echo " KUBECONFIG:"
20
- cat " $KUBECONFIG_DIR /$KUBECONFIG "
20
+ cat " $KUBECONFIG_DIR /kubeconfig "
21
21
echo
22
22
echo " Connect to the ci-runner with: kubectl exec -n default --stdin --tty ci-runner -- bash"
23
23
echo
35
35
source " $SCRIPT_DIR /utils.sh"
36
36
37
37
if [[ -n " $CLUSTER_NAME " ]]; then
38
- echo " Started to destroy cluster [$CLUSTER_NAME ]..."
38
+ echo " [ $( date + " %Y/%m/%d %H:%M:%S " ) ] Started to destroy cluster [$CLUSTER_NAME ]..."
39
39
40
40
printf " Log in to your Red Hat account...\n" | indent 2
41
41
setx_off
@@ -44,7 +44,8 @@ if [[ -n "$CLUSTER_NAME" ]]; then
44
44
45
45
rosa delete cluster --region " $REGION " --cluster=" $CLUSTER_NAME " -y
46
46
rosa logs uninstall --region " $REGION " --cluster=" $CLUSTER_NAME " --watch
47
-
48
47
else
49
48
echo " No OCP cluster need to be destroyed."
50
49
fi
50
+
51
+ echo " [$( date +" %Y/%m/%d %H:%M:%S" ) ] Done"
You can’t perform that action at this time.
0 commit comments