-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
77 lines (59 loc) · 2.16 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.7
NETBOX_VER?=v2.11.6
NAME=netbox-cisco-support
COMPOSE_FILE=./develop/docker-compose.yml
BUILD_NAME=netbox_cisco_support
VERFILE=./netbox_cisco_support/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_cisco_support
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}