diff --git a/modules/packer/Makefile b/modules/packer/Makefile new file mode 100644 index 0000000000..201ecee20d --- /dev/null +++ b/modules/packer/Makefile @@ -0,0 +1,18 @@ +## Packer helpers +PACKER_REPO_BRANCH?=main +PACKER_REPO?=git@gitlab.com:mintel/satoshi/templates/packer-repo.git +PACKER_REPO_DIR=/tmp/packer-repo +PACKER_SOURCE_FILE="sources.pkr.hcl" + +.PHONY: packer/update-sources +## Pulls in the current version of the `sources.pkr.hcl` file from the packer-repo template +packer/update-sources: + @echo "Cloning packer-repo: "${PACKER_REPO}"" + @if [ -f "$(PACKER_SOURCE_FILE)" ]; then \ + rm -rf $(PACKER_SOURCE_FILE) ;\ + fi ;\ + git clone --depth=1 $(PACKER_REPO) -b $(PACKER_REPO_BRANCH) $(PACKER_REPO_DIR) ;\ + echo "Copying "${PACKER_SOURCE_FILE}"" + cp "${PACKER_REPO_DIR}/${PACKER_SOURCE_FILE}" "${PACKER_SOURCE_FILE}" + echo "Cleanup cloned dir ${PACKER_REPO_DIR}" + rm -rf ${PACKER_REPO_DIR} diff --git a/modules/satoshi/packer-makefile.template b/modules/satoshi/packer-makefile.template new file mode 100644 index 0000000000..dc33bdf7e2 --- /dev/null +++ b/modules/satoshi/packer-makefile.template @@ -0,0 +1,25 @@ +# +# DO NOT OVERRIDE THIS FILE. AUTO-GENERATED FROM 'make satoshi/update-makefile/packer' +# +export HELP_FILTER ?= asdf|grafana|jsonnet|k8s|kyverno|opa|pluto|satoshi|updater +-include $(shell curl -sSL -o .build-harness "https://cloudposse.tools/build-harness"; echo .build-harness) +export BUILD_HARNESS_PATH ?= $(shell 'pwd') +export BUILD_HARNESS_EXTENSIONS_PATH ?= $(BUILD_HARNESS_PATH)/build-harness-extensions + +## Init build-harness and build-harness-extensions +.PHONY: bootstrap +bootstrap: + make init + if [ ! -d "./build-harness-extensions" ]; then git submodule add https://github.com/mintel/build-harness-extensions.git build-harness-extensions ; fi + git submodule update --init --recursive + exit 0 + +## Install tools +.PHONY: install +install: + @if [ ! -f .tool-versions ]; then \ + make satoshi/update-tools/packer; \ + else \ + make asdf/install; \ + fi + exit 0 diff --git a/modules/satoshi/packer-tool-versions b/modules/satoshi/packer-tool-versions new file mode 100644 index 0000000000..0a594a961d --- /dev/null +++ b/modules/satoshi/packer-tool-versions @@ -0,0 +1,6 @@ +# +# DO NOT OVERRIDE THIS FILE. AUTO-GENERATED FROM 'make satoshi/update-tools/packer'. +# + +#asdf:plugin add packer +packer 1.10.3 diff --git a/modules/satoshi/tf-makefile.template b/modules/satoshi/tf-makefile.template index a3c2273c67..3cb79d596f 100644 --- a/modules/satoshi/tf-makefile.template +++ b/modules/satoshi/tf-makefile.template @@ -1,5 +1,5 @@ # -# DO NOT OVERRIDE THIS FILE. AUTO-GENERATED FROM 'make satoshi/update-makefile' +# DO NOT OVERRIDE THIS FILE. AUTO-GENERATED FROM 'make satoshi/update-makefile/tf' # export HELP_FILTER ?= asdf|satoshi -include $(shell curl -sSL -o .build-harness "https://cloudposse.tools/build-harness"; echo .build-harness)