-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
58 lines (48 loc) · 1.48 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
circleci := ${CIRCLECI}
current_dir := $(shell pwd)
image_name := $(shell git remote show origin | grep -e 'Push.*URL.*github.com' | rev | cut -d '/' -f 1 | rev | cut -d '.' -f 1)
define create_volume
$(call delete_volume,$(1))
docker volume create $(1)
endef
define delete_volume
$(call unmount_volume,$(1))
docker volume rm $(1) > /dev/null 2>&1 || true
endef
define mount_volume
docker create --mount source=$(1),target=$(2) --name $(1) alpine:3.4 /bin/true
endef
define unmount_volume
docker rm -f $(1) > /dev/null 2>&1 || true
endef
lint:
@flake8 . --ignore=F403 &&\
python -m pip install pip-licenses &&\
(cat .licenseignore | sed 's/^[[:space:]]*$$/__nonexistent__/' > /tmp/licenseignore) &&\
pip-licenses | grep -vf /tmp/licenseignore | (! grep -w GPL)
test:
$(MAKE) lint
tox
install:
python setup.py develop
release:
@python setup.py sdist bdist_wheel upload -r local
clean:
@find . -name '*.pyc' -exec rm -f {} \;
@find . -name '__pycache__' -exec rm -rf {} \;
@find . -name 'Thumbs.db' -exec rm -f {} \;
@find . -name '*~' -exec rm -f {} \;
snyk:
$(call create_volume,$(image_name)-snyk)
$(call mount_volume,$(image_name)-snyk,/src)
@python setup.py snyksync
docker cp . $(image_name)-snyk:/src
docker run --rm -ti \
--volumes-from $(image_name)-snyk \
-e ARTIFACTORY_USERNAME \
-e ARTIFACTORY_PASSWORD \
-e SNYK_LEVEL \
-e SNYK_TOKEN \
-e WORKING_PATH=/src \
upsidetravel-docker.jfrog.io/snyk-python-go-upside:latest
$(call delete_volume,$(image_name)-snyk)