From 682cf24d95a8198b6edadb97408074fd712f0bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Sedl=C3=A1k?= Date: Thu, 1 Jun 2023 13:55:40 +0200 Subject: [PATCH] Make devsetup/cifwm_prepare not fail when rerun Currently if one tries to rerun cifwm_prepare it fails on git cloning attempt since the directory is already in place. Example of failure: > + make cifmw_prepare > git clone https://github.com/openstack-k8s-operators/ci-framework ci-framework > fatal: destination path 'ci-framework' already exists and is not an empty directory. > make: *** [Makefile:180: cifmw_prepare] Error 128 As that is not expected from make target, make it so that this target depends on the directory existing target, which itself calls the git clone for its creation. --- devsetup/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/devsetup/Makefile b/devsetup/Makefile index 0119e1632..bfcc9c076 100644 --- a/devsetup/Makefile +++ b/devsetup/Makefile @@ -175,10 +175,13 @@ edpm_deploy_instance: ## Spin a instance on edpm node edpm_play_cleanup: ## Cleanup EDPM openstackansibleee resource -oc delete openstackansibleee deploy-external-dataplane-compute -.PHONY: cifmw_prepare -cifmw_prepare: ## Clone the ci-framework repository in the ci-framework directory. That location is ignored from git. +./ci-framework: git clone https://github.com/openstack-k8s-operators/ci-framework ci-framework +.PHONY: cifmw_prepare +cifmw_prepare: ./ci-framework ## Clone the ci-framework repository in the ci-framework directory. That location is ignored from git. + cd ci-framework && [[ -n "$$(git status --porcelain)" ]] || git pull --rebase + .PHONY: cifmw_cleanup cifmw_cleanup: ## Clean ci-framework git clone ${CLEANUP_DIR_CMD} ci-framework