From 8f8f173fb86857eb7d5906943d627c7cba69f3ea Mon Sep 17 00:00:00 2001 From: Sunil Shivanand Date: Tue, 10 Jan 2023 16:00:04 +0100 Subject: [PATCH] fix(ci): use if condition to check rollout status (#24) Signed-off-by: Sunil Shivanand --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bd8660e7..0b41e23e 100644 --- a/Makefile +++ b/Makefile @@ -140,8 +140,11 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default | kubectl apply --server-side -f - for w in statefulset/trivy deployment/image-scanner-controller-manager; do \ - kubectl rollout status $$w -n $(K8S_NAMESPACE) --timeout=2m \ - || (kubectl logs -n $(K8S_NAMESPACE) $$w --tail -1; kubectl get events -n $(K8S_NAMESPACE); false); \ + if ! kubectl rollout status $$w -n $(K8S_NAMESPACE) --timeout=2m; then \ + kubectl get events -n $(K8S_NAMESPACE); \ + kubectl logs -n $(K8S_NAMESPACE) $$w --tail -1; \ + exit 1; \ + fi \ done .PHONY: undeploy