diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-07-25 09:02:15 +0000 |
---|---|---|
committer | Alejandro Colomar <alejandro.colomar@exfo.com> | 2021-07-25 12:44:50 +0200 |
commit | 8491c7c8d6cb5e116cd32bfb4899fa0d04f087e0 (patch) | |
tree | eac0341b7afa9d30d94f8a8ad5a5d04559c2fe8f | |
parent | 53fb26e39a8bdd780ed35cddca9830b1ccaf964e (diff) |
Fix recent commits
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r-- | .config | 1 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | etc/docker/image | 3 | ||||
-rw-r--r-- | libexec/img.mk | 39 | ||||
-rw-r--r-- | libexec/stack.mk | 142 | ||||
-rw-r--r-- | run/docker/image | 3 |
6 files changed, 55 insertions, 138 deletions
@@ -3,3 +3,4 @@ port stable 30001 project www version 0.48-rc5 archs aarch64,x86_64 +node worker @@ -64,9 +64,8 @@ digest: stack-deploy: $(MAKE) -C $(CURDIR)/libexec/ -f stack.mk $@ -.PHONY: stack-rm-stable -.PHONY: stack-rm-test -stack-rm-stable stack-rm-test: stack-rm-%: +.PHONY: stack-rm +stack-rm: $(MAKE) -C $(CURDIR)/libexec/ -f stack.mk $@ ######################################################################## diff --git a/etc/docker/image b/etc/docker/image index 7a58285..959ea3d 100644 --- a/etc/docker/image +++ b/etc/docker/image @@ -1,6 +1,3 @@ reg docker.io user alejandrocolomar repo www -lbl 0.48-rc5 -digest x86_64 -digest aarch64 diff --git a/libexec/img.mk b/libexec/img.mk index d39e597..263db3d 100644 --- a/libexec/img.mk +++ b/libexec/img.mk @@ -39,12 +39,11 @@ img = $(repository):$(lbl) img_a = $(repository):$(lbl_a) archs = $(shell <$(config) grep '^archs' | cut -f2 | tr ',' ' ') imgs = $(addprefix $(img)_,$(archs)) -digest = $(shell <$(image) grep '^digest' | grep $(arch) | cut -f3) -digest_ = $(addprefix @,$(digest)) -orchestrator = $(shell <$(config) grep '^orchest' | cut -f2) -stack = $(shell <$(ROOTDIR)/.config grep '^stack' | cut -f2) -project = $(shell <$(ROOTDIR)/.config grep '^project' | cut -f2) +image_ = $(ROOTDIR)/run/docker/image +lbl_ = $(shell <$(image_) grep '^lbl' | cut -f2) +img_ = $(repository):$(lbl_) + .PHONY: all all: image_ @@ -53,16 +52,16 @@ all: image_ Dockerfile: @echo ' Update Dockerfile ARGs'; sed -i \ - -e '/^ARG BUILD_REG=/s/=.*/="$(build_reg)"/' \ - -e '/^ARG BUILD_USER=/s/=.*/="$(build_user)"/' \ - -e '/^ARG BUILD_REPO=/s/=.*/="$(build_repo)"/' \ - -e '/^ARG BUILD_LBL=/s/=.*/="$(build_lbl)"/' \ - -e '/^ARG BUILD_DIGEST=/s/=.*/="$(build_digest)"/' \ - -e '/^ARG NGINX_REG=/s/=.*/="$(nginx_reg)"/' \ - -e '/^ARG NGINX_USER=/s/=.*/="$(nginx_user)"/' \ - -e '/^ARG NGINX_REPO=/s/=.*/="$(nginx_repo)"/' \ - -e '/^ARG NGINX_LBL=/s/=.*/="$(nginx_lbl)"/' \ - -e '/^ARG NGINX_DIGEST=/s/=.*/="$(nginx_digest)"/' \ + -e '/^ARG BUILD_REG=/s/=.*/="$(build_reg)"/' \ + -e '/^ARG BUILD_USER=/s/=.*/="$(build_user)"/' \ + -e '/^ARG BUILD_REPO=/s/=.*/="$(build_repo)"/' \ + -e '/^ARG BUILD_LBL=/s/=.*/="$(build_lbl)"/' \ + -e '/^ARG BUILD_DIGEST=/s/=.*/="$(build_digest)"/' \ + -e '/^ARG NGINX_REG=/s/=.*/="$(nginx_reg)"/' \ + -e '/^ARG NGINX_USER=/s/=.*/="$(nginx_user)"/' \ + -e '/^ARG NGINX_REPO=/s/=.*/="$(nginx_repo)"/' \ + -e '/^ARG NGINX_LBL=/s/=.*/="$(nginx_lbl)"/' \ + -e '/^ARG NGINX_DIGEST=/s/=.*/="$(nginx_digest)"/' \ $(ROOTDIR)/$@; .PHONY: image_ @@ -71,6 +70,7 @@ image_: git checkout -f 'version-$(version_)'; git clean -fx; $(MAKE) -f img.mk image version=$(version_); + $(MAKE) -f img.mk update-run; git add $(image); git commit -m 'Build $(img)'; git push; @@ -97,7 +97,7 @@ image-push: | grep 'digest:' \ | sed -E 's/.*digest: ([^ ]+) .*/\1/' \ | while read d; do \ - sed -Ei "s/(digest $(arch)).*/\1 $${d}/" $(image); \ + sed -Ei "s/(digest $(arch)).*/\1 $${d}/" $(image_); \ done; .PHONY: image-manifest @@ -109,9 +109,14 @@ image-manifest: image-manifest-create: @echo ' DOCKER manifest create $(img)'; docker manifest create '$(img)' $(imgs) >/dev/null; - sed -i 's/^lbl.*/lbl $(lbl)/' $(image); + sed -i 's/^lbl.*/lbl $(lbl)/' $(image_); .PHONY: image-manifest-push image-manifest-push: @echo ' DOCKER manifest push $(img)'; docker manifest push '$(img)' >/dev/null; + +.PHONY: update-run +update-run: + git add $(image_) + git commit -m 'Build $(img_)' diff --git a/libexec/stack.mk b/libexec/stack.mk index 68eb7e3..8db62a3 100644 --- a/libexec/stack.mk +++ b/libexec/stack.mk @@ -1,135 +1,47 @@ -#!/usr/bin/make -f ######################################################################## # Copyright (C) 2021 Alejandro Colomar <alx.manpages@gmail.com> # SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.0-only ######################################################################## -# Do not print "Entering directory ..." -MAKEFLAGS += --no-print-directory +arch = $(shell uname -m) -DESTDIR = -prefix = /usr/local -sysconfdir = $(prefix:/usr=)/etc -MANDIR_ = $(CURDIR)/src/man-pages/ -htmlbuilddir = $(CURDIR)/tmp/html -srvdir = /srv -wwwdir = $(srvdir)/www -htmlext = .html - -version = $(shell git describe --tags | sed 's/^v//') - -INSTALL = install -INSTALL_DATA = $(INSTALL) -m 644 -INSTALL_DIR = $(INSTALL) -m 755 -d - -arch_cur = $(shell uname -m) -arch = $(shell uname -m) - -config = $(CURDIR)/.config -project = $(shell <$(config) grep '^project' | cut -f2) +config = $(ROOTDIR)/.config orchestrator = swarm - -build = $(CURDIR)/etc/docker/image.d/build-essential -build_reg = $(shell <$(build) grep '^reg' | cut -f2) -build_user = $(shell <$(build) grep '^user' | cut -f2) -build_repo = $(shell <$(build) grep '^repo' | cut -f2) -build_lbl = $(shell <$(build) grep '^lbl' | cut -f2) -build_digest = $(shell <$(build) grep '^digest' | grep $(arch_cur) | cut -f3) - -nginx = $(CURDIR)/etc/docker/image.d/nginx -nginx_reg = $(shell <$(nginx) grep '^reg' | cut -f2) -nginx_user = $(shell <$(nginx) grep '^user' | cut -f2) -nginx_repo = $(shell <$(nginx) grep '^repo' | cut -f2) -nginx_lbl = $(shell <$(nginx) grep '^lbl' | cut -f2) -nginx_digest = $(shell <$(nginx) grep '^digest' | grep $(arch) | cut -f3) - -image = $(CURDIR)/etc/docker/image -reg = $(shell <$(image) grep '^reg' | cut -f2) -user = $(shell <$(image) grep '^user' | cut -f2) -repo = $(shell <$(image) grep '^repo' | cut -f2) +project = $(shell <$(config) grep '^project' | cut -f2) +stability = test +stack = $(project)-$(stability) +version_ = $(shell <$(config) grep '^version' | cut -f2) +node_role = $(shell <$(config) grep '^node' | cut -f2) +host_port = $(shell <$(config) grep '^port' | grep '$(stability)' | cut -f3) + +image = $(ROOTDIR)/etc/docker/image +reg = $(shell <$(image) grep '^reg' | cut -f2) +user = $(shell <$(image) grep '^user' | cut -f2) +repo = $(shell <$(image) grep '^repo' | cut -f2) repository = $(reg)/$(user)/$(repo) -lbl = $(shell <$(image) grep '^lbl' | cut -f2) -lbl_ = $(version) -lbl_a = $(lbl_)_$(arch) -img = $(repository):$(lbl) -img_a = $(repository):$(lbl_a) -archs = $(shell <$(config) grep '^archs' | cut -f2 | tr ',' ' ') -imgs = $(addprefix $(img)_,$(archs)) -digest = $(shell <$(image) grep '^digest' | grep $(arch) | cut -f3) -digest_ = $(addprefix @,$(digest)) -.PHONY: all -all: man +image_ = $(ROOTDIR)/run/docker/image +lbl_ = $(shell <$(image_) grep '^lbl' | cut -f2) +img_ = $(repository):$(lbl_) +digest_ = @$(shell <$(image_) grep '^digest' | grep '$(arch)' | cut -f3) -######################################################################## -# ./libexec deps.mk - -.PHONY: deps-build -deps-build: - $(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@; - -.PHONY: deps-run -deps-run: - $(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@; +.PHONY: all +all: stack-deploy ######################################################################## -.PHONY: Dockerfile -Dockerfile: - @echo ' Update Dockerfile ARGs'; - sed -i \ - -e '/^ARG BUILD_REG=/s/=.*/="$(build_reg)"/' \ - -e '/^ARG BUILD_USER=/s/=.*/="$(build_user)"/' \ - -e '/^ARG BUILD_REPO=/s/=.*/="$(build_repo)"/' \ - -e '/^ARG BUILD_LBL=/s/=.*/="$(build_lbl)"/' \ - -e '/^ARG BUILD_DIGEST=/s/=.*/="$(build_digest)"/' \ - -e '/^ARG NGINX_REG=/s/=.*/="$(nginx_reg)"/' \ - -e '/^ARG NGINX_USER=/s/=.*/="$(nginx_user)"/' \ - -e '/^ARG NGINX_REPO=/s/=.*/="$(nginx_repo)"/' \ - -e '/^ARG NGINX_LBL=/s/=.*/="$(nginx_lbl)"/' \ - -e '/^ARG NGINX_DIGEST=/s/=.*/="$(nginx_digest)"/' \ - $(CURDIR)/$@; - -.PHONY: digest -digest: - @echo ' Update digest'; - sed -i '\#$(repository)#s#$(lbl).*"$$#$(lbl)$(digest_)"#' \ - $(CURDIR)/etc/swarm/manifests/compose.yaml; - -.PHONY: install -install: install-srv - -.PHONY: install-srv -install-srv: | installdirs-srv - @echo ' INSTALL $(DESTDIR)$(srvdir)/**'; - cd srv/ && \ - find ./ -type f \ - |while read f; do \ - $(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(srvdir)/$$f" || exit $$?; \ - done; - -.PHONY: installdirs-srv -installdirs-srv: - @cd srv/ && \ - find ./ -type d \ - |while read d; do \ - $(INSTALL_DIR) "$(DESTDIR)$(srvdir)/$$d" || exit $$?; \ - done; - -.PHONY: stack-deploy-stable -.PHONY: stack-deploy-test -stack-deploy-stable stack-deploy-test: digest - @echo ' STACK deploy $(project)-$*'; +.PHONY: stack-deploy +stack-deploy: + @echo ' STACK deploy $(stack)'; export node_role='$(node_role)'; \ export image='$(repository)'; \ export label='$(lbl_)'; \ export digest='$(digest_)'; \ export host_port='$(host_port)'; \ cd $(ROOTDIR); \ - @alx_stack_deploy -o '$(orchestrator)' '$(project)-$*'; + alx_stack_deploy -o '$(orchestrator)' '$(stack)'; -.PHONY: stack-rm-stable -.PHONY: stack-rm-test -stack-rm-stable stack-rm-test: stack-rm-%: - @echo ' STACK rm $(orchestrator) $(project)-$*'; - alx_stack_delete -o '$(orchestrator)' '$(project)-$*'; +.PHONY: stack-rm +stack-rm: + @echo ' STACK rm $(orchestrator) $(stack)'; + alx_stack_delete -o '$(orchestrator)' '$(stack)'; diff --git a/run/docker/image b/run/docker/image new file mode 100644 index 0000000..19c1bb4 --- /dev/null +++ b/run/docker/image @@ -0,0 +1,3 @@ +lbl 0.48-rc11 +digest x86_64 +digest aarch64 |