Merge update from Common

This commit is contained in:
ducoterra
2021-12-13 12:58:41 -05:00
5 changed files with 41 additions and 20 deletions

1
.gitlab/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.gitlab

View File

@@ -6,13 +6,16 @@ IMAGE ?= $(shell cat IMAGE):$(VERSION)
IMAGE_LATEST ?= $(shell cat IMAGE):latest
PWD ?= $(shell pwd)
STASH ?= "common-update-stash"
MAKE_BRANCH ?= main
include .gitlab/make/docker.makefile
include .gitlab/make/helm.makefile
include .gitlab/make/kaniko.makefile
include .gitlab/make/truenas.makefile
include .gitlab/make/git.makefile
include .gitlab/make/kubectl.makefile
# git subtree add --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
.PHONY: make-update
make-update:
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git $(MAKE_BRANCH)

View File

@@ -3,27 +3,21 @@ docker-init:
@touch VERSION
@touch IMAGE
.PHONY: buildx-context
buildx-context:
docker buildx create --name container-builder --use --platform linux/amd64,linux/arm64
.PHONY: docker-buildx-context
docker-buildx-context:
@docker buildx create --name container-builder --use --platform linux/amd64,linux/arm64
.PHONY: buildx-clear
buildx-clear:
docker buildx rm container-builder
.PHONY: docker-buildx-clear
docker-buildx-clear:
@docker buildx rm container-builder
.PHONY: build
build:
docker buildx build --load . -t $(IMAGE)
@docker buildx build --load . -t $(IMAGE_LATEST)
.PHONY: docker-build
docker-build:
docker build . -t $(IMAGE)
.PHONY: push
push:
-make buildx-clear
@make buildx-context
.PHONY: docker-push
docker-push:
-make docker-buildx-clear
@make docker-buildx-context
docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE)
@docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE_LATEST)
.PHONY: docker-release
docker-release:
@yq e ".services.minecraft.image = \"$(IMAGE)\"" -i docker-compose.yaml
@make push

View File

@@ -2,3 +2,15 @@
helm-release:
@yq e ".version = \"$(shell cat VERSION)\"" -i helm/Chart.yaml
@yq e ".appVersion = \"$(shell cat VERSION)\"" -i helm/Chart.yaml
.PHONY: install
install: set-namespace
helm install $(PROJECT_NAME) ./helm --set image=$(IMAGE)
.PHONY: upgrade
upgrade: set-namespace
helm upgrade $(PROJECT_NAME) ./helm --set image=$(IMAGE)
.PHONY: uninstall
uninstall: set-namespace
helm uninstall $(PROJECT_NAME)

View File

@@ -0,0 +1,11 @@
.PHONY: set-namespace
set-namespace:
kubectl config set contexts.$(shell kubectl config current-context).namespace $(shell cat NAMESPACE)
.PHONY: create-regcred
create-regcred:
@kubectl create secret docker-registry regcred \
--docker-server=registry.ducoterra.net \
--docker-username=$(shell vault kv get -field username secret/duconet/basic-auth) \
--docker-password='$(shell vault kv get -field password secret/duconet/basic-auth)' \
--docker-email=$(shell vault kv get -field username secret/duconet/basic-auth)