2023-02-18 12:49:35 +00:00
|
|
|
NAME = netoik-cicd
|
|
|
|
VERSION = $(shell [ -d ".git" ] && git describe | sed "s/-/./g")
|
|
|
|
BRANCH = $(shell [ -d ".git" ] && git branch --show-current)
|
|
|
|
|
|
|
|
RPM_SOURCEDIR = $(shell rpm --eval "%{_sourcedir}")
|
|
|
|
|
|
|
|
SYSCONFDIR = $(shell rpm --eval "%{_sysconfdir}")
|
|
|
|
UNITDIR = $(shell rpm --eval "%{_unitdir}")
|
|
|
|
BINDIR = $(shell rpm --eval "%{_bindir}")
|
|
|
|
TMPDIR = $(shell rpm --eval "%{_tmppath}")
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: bin/$(NAME)-deployer bin/$(NAME)-newtag
|
|
|
|
|
|
|
|
bin/$(NAME)-deployer: src/deployer.sh
|
|
|
|
mkdir --parents bin
|
|
|
|
cp "$<" "$@"
|
|
|
|
|
|
|
|
bin/$(NAME)-newtag: src/newtag.sh
|
|
|
|
mkdir --parents bin
|
|
|
|
cp "$<" "$@"
|
|
|
|
|
|
|
|
.PHONY: name
|
|
|
|
name:
|
|
|
|
@echo "$(NAME)"
|
|
|
|
|
|
|
|
.PHONY: version
|
|
|
|
version:
|
|
|
|
@echo "$(VERSION)"
|
|
|
|
|
|
|
|
$(RPM_SOURCEDIR)/$(NAME)-%.tar.gz: *
|
|
|
|
git archive --format=tar.gz --output="$@" --prefix="$(NAME)-$(VERSION)/" --worktree-attributes --verbose "$(BRANCH)"
|
|
|
|
|
|
|
|
.PHONY: tarball
|
|
|
|
tarball: $(RPM_SOURCEDIR)/$(NAME)-$(VERSION).tar.gz
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install:
|
|
|
|
install -D --no-target-directory deployer.conf.sample "$(DESTDIR)$(SYSCONFDIR)/$(NAME)/deployer.conf"
|
|
|
|
install -D --target-directory="$(DESTDIR)$(SYSCONFDIR)/$(NAME)" deployer.conf.sample
|
|
|
|
install -D --target-directory="$(DESTDIR)$(SYSCONFDIR)/profile.d" profile/$(NAME)-git.sh
|
|
|
|
install -D --target-directory="$(DESTDIR)$(UNITDIR)" systemd/$(NAME)-deployer.service
|
|
|
|
install -D --target-directory="$(DESTDIR)$(BINDIR)" bin/$(NAME)-*
|
|
|
|
install --directory "$(DESTDIR)$(TMPDIR)/$(NAME)/deployer/request"
|
|
|
|
install --directory "$(DESTDIR)$(TMPDIR)/$(NAME)/deployer/response"
|
2023-02-21 17:04:04 +00:00
|
|
|
|
|
|
|
.PHONY: check_format
|
|
|
|
check_format:
|
|
|
|
shfmt --diff .
|
|
|
|
|
|
|
|
.PHONY: check_linting
|
|
|
|
check_linting:
|
|
|
|
shfmt --find . | xargs bash -o noexec
|
|
|
|
shfmt --find . | xargs shellcheck
|
|
|
|
|
|
|
|
.PHONY: unit_test
|
|
|
|
unit_test:
|
|
|
|
@echo "not implemented yet"
|