From 51fc36d59142e83837d103c5d5d3f6af9fcd4f2e Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Mon, 29 Nov 2021 11:26:38 -0700 Subject: [PATCH] build: prevent parallel build collisions for ceph Prevent parallel build collisions in the 'ceph' image by building prerequisites for the builds before running the build targets in parallel. Build targets can collide and try to create the same target at nearly the same time, causing failures. Signed-off-by: Blaine Gardner --- Makefile | 2 +- images/Makefile | 4 +++- images/ceph/Makefile | 11 +++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5e52acafd..9675d6a9a 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ build.version: @mkdir -p $(OUTPUT_DIR) @echo "$(VERSION)" > $(OUTPUT_DIR)/version -build.common: build.version helm.build mod.check +build.common: build.version helm.build mod.check crds @$(MAKE) go.init @$(MAKE) go.validate @$(MAKE) -C images/ceph list-image diff --git a/images/Makefile b/images/Makefile index 040e9d3f9..d3d153a5f 100644 --- a/images/Makefile +++ b/images/Makefile @@ -30,7 +30,9 @@ ceph.%: @$(MAKE) -C ceph PLATFORM=$* do.build: ceph.$(PLATFORM) ; -build.all: $(foreach p,$(PLATFORMS), ceph.$(p)) ; ## Build images for all platforms. +build.all: ## Build images for all platforms. + $(MAKE) -C ceph prerequisites + $(MAKE) $(foreach p,$(PLATFORMS), ceph.$(p)) ; # ==================================================================================== # Help diff --git a/images/ceph/Makefile b/images/ceph/Makefile index 978d7335b..2d71cf7c5 100755 --- a/images/ceph/Makefile +++ b/images/ceph/Makefile @@ -84,7 +84,8 @@ do.build: ifeq ($(INCLUDE_CSV_TEMPLATES),true) @$(MAKE) CSV_TEMPLATE_DIR=$(TEMP) generate-csv-templates - @$(MAKE) CRD_TEMPLATE_DIR=$(TEMP)/deploy/olm/templates/crds/ get-volume-replication-crds + @$(MAKE) get-volume-replication-crds + cp $(CACHE_DIR)/crds/* $(TEMP)/deploy/olm/templates/crds/. @cp -r $(TEMP)/deploy/olm/templates $(TEMP)/ceph-csv-templates else mkdir $(TEMP)/ceph-csv-templates @@ -99,6 +100,10 @@ endif fi @rm -fr $(TEMP) +# call this before building multiple arches in parallel to prevent parallel build processes from +# conflicting +prerequisites: $(OPERATOR_SDK) $(YQv3) get-volume-replication-crds + # generate CSV template files into the directory defined by the env var CSV_TEMPLATE_DIR # CSV_TEMPLATE_DIR will be created if it doesn't already exist generate-csv-templates: $(OPERATOR_SDK) $(YQv3) ## Generate CSV templates for OLM into CSV_TEMPLATE_DIR @@ -122,13 +127,11 @@ generate-csv-templates: $(OPERATOR_SDK) $(YQv3) ## Generate CSV templates for OL @echo " === Generated CSV templates can be found at $(CSV_TEMPLATE_DIR)/deploy/olm/templates" get-volume-replication-crds: - @if [[ -z "$(CRD_TEMPLATE_DIR)" ]]; then echo "CRD_TEMPLATE_DIR is not set"; exit 1; fi - @if [[ ! -d "$(CACHE_DIR)/crds" ]]; then\ + if [[ ! -d "$(CACHE_DIR)/crds" ]]; then\ mkdir -p $(CACHE_DIR)/crds;\ curl -L $(VOL_REPL_URL)/$(VOLUME_REPLICATION_CRD) -o $(CACHE_DIR)/crds/$(VOLUME_REPLICATION_CRD);\ curl -L $(VOL_REPL_URL)/$(VOLUME_REPLICATION_CLASS_CRD) -o $(CACHE_DIR)/crds/$(VOLUME_REPLICATION_CLASS_CRD);\ fi - @cp $(CACHE_DIR)/crds/* $(CRD_TEMPLATE_DIR) $(YQv3): @echo === installing yq $(YQv3_VERSION) $(REAL_HOST_PLATFORM)