Skip to content

Commit

Permalink
feat: generate the repository
Browse files Browse the repository at this point in the history
This is not a production system, but a useful way to allow gitops-templates
developer to check the files that are generated.
  • Loading branch information
mrsimonemms committed Aug 21, 2024
1 parent eadaad9 commit b30ce04
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
.vscode
.DS_Store
deprecated-*
kubeconfig-*
kubeconfig-*
tmp
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
CLOUD_PROVIDER ?=
VCS_PROVIDER ?=

default: help

.PHONY: help
Expand All @@ -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

0 comments on commit b30ce04

Please sign in to comment.