diff --git a/Makefile b/Makefile index 590cfab..6e4f1b6 100644 --- a/Makefile +++ b/Makefile @@ -435,6 +435,7 @@ NNCP_CTLPLANE_IPV6_ADDRESS_SUFFIX ?=10 NNCP_GATEWAY_IPV6 ?=fd00:aaaa::1 NNCP_DNS_SERVER_IPV6 ?=fd00:aaaa::1 NNCP_ADDITIONAL_HOST_ROUTES ?= +NNCP_RETRIES ?= 5 # MetalLB ifeq ($(NETWORK_ISOLATION_USE_DEFAULT_NETWORK), true) @@ -667,8 +668,8 @@ endif OPENSTACK_PREP_DEPS := validate_marketplace OPENSTACK_PREP_DEPS += $(if $(findstring true,$(INSTALL_CERT_MANAGER)), certmanager) -OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_ISOLATION)), nmstate nncp netattach metallb metallb_config) -OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_BGP)), nmstate nncp netattach metallb metallb_config) +OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_ISOLATION)), nmstate nncp_with_retries netattach metallb metallb_config) +OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_BGP)), nmstate nncp_with_retries netattach metallb metallb_config) OPENSTACK_PREP_DEPS += $(if $(findstring true,$(BMO_SETUP)), crc_bmo_setup) .PHONY: openstack_prep @@ -2154,6 +2155,12 @@ else oc wait deployments/nmstate-webhook -n ${NAMESPACE} --for condition=Available --timeout=${TIMEOUT} endif +.PHONY: nncp_with_retries +nncp_with_retries: ## Deploy NNCP with retries + $(eval $(call vars,$@)) + bash scripts/retry_make_nncp.sh $(NNCP_RETRIES) + + .PHONY: nncp nncp: export INTERFACE=${NNCP_INTERFACE} nncp: export BRIDGE_NAME=${NNCP_BRIDGE} diff --git a/scripts/retry_make_nncp.sh b/scripts/retry_make_nncp.sh new file mode 100644 index 0000000..be56c96 --- /dev/null +++ b/scripts/retry_make_nncp.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +n=0 +retries="${1:-5}" # Number of retries with a default value of 5 + +while true; do + make nncp && break + make nncp_cleanup + n=$((n+1)) + if (( n >= retries )); then + echo "Failed to run 'make nncp' target. Aborting" + exit 1 + fi + sleep 10 +done