-
Notifications
You must be signed in to change notification settings - Fork 51
/
Makefile
77 lines (59 loc) · 2.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
PYTHON_VER?=3.10
NETBOX_VER?=v4.0.2
NAME=netbox-bgp
COMPOSE_FILE=./develop/docker-compose.yml
BUILD_NAME=netbox_bgp
VERFILE=./netbox_bgp/version.py
cbuild:
docker-compose -f ${COMPOSE_FILE} \
-p ${BUILD_NAME} build \
--build-arg netbox_ver=${NETBOX_VER} \
--build-arg python_ver=${PYTHON_VER}
debug:
@echo "Starting Netbox .. "
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up
start:
@echo "Starting Netbox in detached mode.. "
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d
stop:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
destroy:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
docker volume rm -f ${BUILD_NAME}_pgdata_netbox_bgp
nbshell:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py nbshell
shell:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py shell
adduser:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py createsuperuser
collectstatic:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py collectstatic
migrations:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d postgres
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} \
run netbox python manage.py makemigrations --name ${BUILD_NAME}
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
pbuild:
python3 -m pip install --upgrade build
python3 -m build
pypipub:
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
relpatch:
$(eval GSTATUS := $(shell git status --porcelain))
ifneq ($(GSTATUS),)
$(error Git status is not clean. $(GSTATUS))
endif
git checkout develop
git remote update
git pull origin develop
$(eval CURVER := $(shell cat $(VERFILE) | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'))
$(eval NEWVER := $(shell pysemver bump patch $(CURVER)))
$(eval RDATE := $(shell date '+%Y-%m-%d'))
git checkout -b release-$(NEWVER) origin/develop
echo '__version__ = "$(NEWVER)"' > $(VERFILE)
git commit -am 'bump ver'
git push origin release-$(NEWVER)
git checkout develop
test:
docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py test ${BUILD_NAME}