diff --git a/.gitignore b/.gitignore index 1763e7908..b585f7940 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ .vscode .DS_Store deprecated-* -kubeconfig-* \ No newline at end of file +kubeconfig-* +tmp diff --git a/Makefile b/Makefile index 9b64c4520..5cf106c34 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +CLOUD_PROVIDER ?= +VCS_PROVIDER ?= + default: help .PHONY: help @@ -15,3 +18,27 @@ validate: ## terraform validate terraform -chdir=$$dir init -backend=false || exit 1; \ terraform -chdir=$$dir validate || exit 1; \ done + +.PHONY: generate +generate: + @rm -Rf tmp + @mkdir tmp + +ifeq ($(CLOUD_PROVIDER), ) + @echo "CLOUD_PROVIDER envvar must be set" + @exit 1 +endif + +ifeq ($(VCS_PROVIDER), ) + @echo "VCS_PROVIDER envvar must be set" + @exit 1 +endif + + @if ! test -d common/cloud/${CLOUD_PROVIDER}; then echo "Cannot find directory: common/cloud/${CLOUD_PROVIDER}" && exit 1; fi + @if ! test -d common/vcs/${VCS_PROVIDER}; then echo "Cannot find directory: common/vcs/${VCS_PROVIDER}" && exit 1; fi + @if ! test -d templates/${CLOUD_PROVIDER}-${VCS_PROVIDER}; then echo "Cannot find directory: templates/${CLOUD_PROVIDER}-${VCS_PROVIDER}" && exit 1; fi + + @cp -r common/templates/* tmp + @cp -r common/cloud/${CLOUD_PROVIDER}/* tmp + @cp -r common/vcs/${VCS_PROVIDER}/* tmp + @cp -r templates/${CLOUD_PROVIDER}-${VCS_PROVIDER}/* tmp