File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,6 +122,30 @@ validate-prereq: ## verify pre-requisites
122122 @if ! ansible-galaxy collection list | grep kubernetes.core > /dev/null 2>&1 ; then echo " Not found" ; exit 1; fi
123123 @echo " OK"
124124
125+ .PHONY : argo-healthcheck
126+ argo-healthcheck : # # Checks if all argo applications are synced
127+ @echo " Checking argo applications"
128+ $(eval APPS := $(shell oc get applications -A -o jsonpath='{range .items[* ]}{@.metadata.namespace}{","}{@.metadata.name}{"\n"}{end}') )
129+ @NOTOK=0; \
130+ for i in $( APPS) ; do\
131+ n=` echo " $$ {i}" | cut -f1 -d,` ; \
132+ a=` echo " $$ {i}" | cut -f2 -d,` ; \
133+ STATUS=` oc get -n " $$ {n}" application/" $$ {a}" -o jsonpath=' {.status.sync.status}' ` ; \
134+ if [[ $$ STATUS != " Synced" ]]; then\
135+ NOTOK=$$(( $${NOTOK} + 1 ) ); \
136+ fi ; \
137+ HEALTH=` oc get -n " $$ {n}" application/" $$ {a}" -o jsonpath=' {.status.health.status}' ` ; \
138+ if [[ $$ HEALTH != " Healthy" ]]; then\
139+ NOTOK=$$(( $${NOTOK} + 1 ) ); \
140+ fi ; \
141+ echo " $$ {n} $$ {a} -> Sync: $$ {STATUS} - Health: $$ {HEALTH}" ; \
142+ done ; \
143+ if [ $$ {NOTOK} -gt 0 ]; then\
144+ echo " Some applications are not synced or are unhealthy" ; \
145+ exit 1; \
146+ fi
147+
148+
125149# #@ Test and Linters Tasks
126150
127151CHARTS =$(shell find . -type f -iname 'Chart.yaml' -exec dirname "{}" \; | grep -v examples | sed -e 's/.\///')
You can’t perform that action at this time.
0 commit comments