From f18752299dcd122df7f9dabb30398a55fef302b0 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sat, 30 Oct 2021 22:28:20 -0400 Subject: [PATCH 1/5] init --- Makefile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0792771 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +SHELL := /bin/bash + +IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION) +IMAGE_LATEST ?= $(shell cat IMAGE):latest +PWD ?= $(shell pwd) + +.PHONY: buildx-context +buildx-context: + docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64 + +.PHONY: buildx-clear +buildx-clear: + docker buildx rm arm64 + +.PHONY: build +build: + docker buildx build --load . -t $(IMAGE) + @docker buildx build --load . -t $(IMAGE_LATEST) + +.PHONY: push +push: + docker buildx build --platform linux/amd64 --push . -t $(IMAGE) + @docker buildx build --platform linux/amd64 --push . -t $(IMAGE_LATEST) + +.PHONY: run +run: + docker run -it -v $(PWD):/mc_data $(IMAGE) bash From 8a52a21a398f3bb2840e76e26f065a7963c79efa Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sun, 31 Oct 2021 15:03:59 -0400 Subject: [PATCH 2/5] Switch to multi-makefile strategy Instead of putting everything in one makefile switch to a folder called "make" with multiple makefiles. Move the original makefile to "docker.makefile" and add kaniko and truenas to fill in later. --- Makefile | 24 +++--------------------- make/docker.makefile | 26 ++++++++++++++++++++++++++ make/kaniko.makefile | 0 make/truenas.makefile | 0 4 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 make/docker.makefile create mode 100644 make/kaniko.makefile create mode 100644 make/truenas.makefile diff --git a/Makefile b/Makefile index 0792771..4bcb9cd 100644 --- a/Makefile +++ b/Makefile @@ -4,24 +4,6 @@ IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION) IMAGE_LATEST ?= $(shell cat IMAGE):latest PWD ?= $(shell pwd) -.PHONY: buildx-context -buildx-context: - docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64 - -.PHONY: buildx-clear -buildx-clear: - docker buildx rm arm64 - -.PHONY: build -build: - docker buildx build --load . -t $(IMAGE) - @docker buildx build --load . -t $(IMAGE_LATEST) - -.PHONY: push -push: - docker buildx build --platform linux/amd64 --push . -t $(IMAGE) - @docker buildx build --platform linux/amd64 --push . -t $(IMAGE_LATEST) - -.PHONY: run -run: - docker run -it -v $(PWD):/mc_data $(IMAGE) bash +include make/docker.makefile +include make/kaniko.makefile +include make/truenas.makefile diff --git a/make/docker.makefile b/make/docker.makefile new file mode 100644 index 0000000..4af850f --- /dev/null +++ b/make/docker.makefile @@ -0,0 +1,26 @@ +.PHONY: docker-init +docker-init: + @touch VERSION + @touch IMAGE + +.PHONY: buildx-context +buildx-context: + docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64 + +.PHONY: buildx-clear +buildx-clear: + docker buildx rm arm64 + +.PHONY: build +build: + docker buildx build --load . -t $(IMAGE) + @docker buildx build --load . -t $(IMAGE_LATEST) + +.PHONY: push +push: + docker buildx build --platform linux/amd64 --push . -t $(IMAGE) + @docker buildx build --platform linux/amd64 --push . -t $(IMAGE_LATEST) + +.PHONY: run +run: + docker run -it -v $(PWD):/mc_data $(IMAGE) bash diff --git a/make/kaniko.makefile b/make/kaniko.makefile new file mode 100644 index 0000000..e69de29 diff --git a/make/truenas.makefile b/make/truenas.makefile new file mode 100644 index 0000000..e69de29 From 4146777f85d88627895d5cba013776e6696eca83 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sun, 31 Oct 2021 20:21:08 -0400 Subject: [PATCH 3/5] Add helm.makefile Add helm.makefile with a helm-release command to make a helm release. --- make/helm.makefile | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 make/helm.makefile diff --git a/make/helm.makefile b/make/helm.makefile new file mode 100644 index 0000000..f603af4 --- /dev/null +++ b/make/helm.makefile @@ -0,0 +1,4 @@ +.PHONY: helm-release +helm-release: + @yq e ".version = \"$(shell cat VERSION)\"" -i helm/Chart.yaml + @yq e ".appVersion = \"$(shell cat VERSION)\"" -i helm/Chart.yaml From 3e8ca713580da108c8b44279542f7cfe4e754f4c Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sun, 31 Oct 2021 20:22:20 -0400 Subject: [PATCH 4/5] Add chart-release to truenas.makefile Add chart-release to add a subtree chart to the charts releases in the charts repo. --- make/truenas.makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/make/truenas.makefile b/make/truenas.makefile index e69de29..c6fb58c 100644 --- a/make/truenas.makefile +++ b/make/truenas.makefile @@ -0,0 +1,3 @@ +.PHONY: chart-release +chart-release: + @rsync -av $(CHART)/helm/ charts/$(CHART)/$(shell cat $(CHART)/VERSION)/ From 74a4a4e77f5fa40b486ae9b94a91e53b3ace5d65 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sun, 31 Oct 2021 20:33:47 -0400 Subject: [PATCH 5/5] Transition to .gitlab prefix Expect repo to be subtree'd as ".gitlab" --- Makefile | 7 ++++--- README.md | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/Makefile b/Makefile index 4bcb9cd..1575e0d 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION) IMAGE_LATEST ?= $(shell cat IMAGE):latest PWD ?= $(shell pwd) -include make/docker.makefile -include make/kaniko.makefile -include make/truenas.makefile +include .gitlab/make/docker.makefile +include .gitlab/make/helm.makefile +include .gitlab/make/kaniko.makefile +include .gitlab/make/truenas.makefile diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d084b1 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Adding the "common" subtree as your .gitlab folder + +```bash +# Add the subtree as a remote +git remote add common git@gitlab.ducoterra.net:services/common.git +git subtree add --prefix .gitlab common main + +# Now you can run the following to update +git subtree pull --prefix .gitlab common main +```