2014-04-16 22:40:15 +04:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
# Copyright (c) 2014 Mozilla Corporation
|
|
|
|
#
|
|
|
|
|
2014-04-01 08:06:49 +04:00
|
|
|
# usage:
|
2017-09-06 17:27:01 +03:00
|
|
|
# make multiple-build - build new mozdef environment in multiple containers
|
2017-12-08 23:32:34 +03:00
|
|
|
# make multiple-build-tests - build new mozdef environment for tests in multiple containers
|
2017-09-07 06:14:10 +03:00
|
|
|
# make multiple-build-no-cache - build new mozdef environment in multiple containers from scratch
|
2017-09-06 17:27:01 +03:00
|
|
|
# make multiple-run - run new mozdef environment in multiple containers
|
2017-12-08 23:32:34 +03:00
|
|
|
# make multiple-run-tests - run new mozdef environment for tests in multiple containers
|
2017-09-06 17:27:01 +03:00
|
|
|
# make multiple-stop - stop new mozdef environment in multiple containers
|
2017-12-08 23:32:34 +03:00
|
|
|
# make multiple-stop-tests - stop new mozdef environment for tests in multiple containers
|
2017-10-11 01:24:55 +03:00
|
|
|
# make multiple-rm - stop new mozdef environment in multiple containers and deattach volumes
|
2018-02-09 22:56:37 +03:00
|
|
|
# make multiple-rm-tests - stop new mozdef tests environment in multiple containers and deattach volumes
|
2017-09-06 17:27:01 +03:00
|
|
|
# make multiple-rebuild - build, stop and run new mozdef environment in multiple containers
|
2017-10-11 01:24:55 +03:00
|
|
|
# make multiple-rebuild-new - build, stop/rm and run new mozdef environment in multiple containers
|
2017-12-08 23:33:31 +03:00
|
|
|
# make multiple-rebuild-tests - build, stop/rm and run new mozdef environment for tests in multiple containers
|
2018-02-09 22:58:29 +03:00
|
|
|
# make multiple-rebuild-tests-new - build, stop/rm and run new mozdef environment for tests in multiple containers
|
2014-04-01 08:06:49 +04:00
|
|
|
|
2018-10-16 00:37:10 +03:00
|
|
|
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
2018-10-16 01:39:22 +03:00
|
|
|
NAME := mozdef
|
|
|
|
VERSION := 0.1
|
|
|
|
NO_CACHE := #--no-cache
|
2014-04-01 08:06:49 +04:00
|
|
|
|
2018-10-16 01:39:22 +03:00
|
|
|
.PHONY:all
|
2018-10-16 00:37:10 +03:00
|
|
|
all:
|
|
|
|
@echo 'Available make targets:'
|
2018-10-16 01:39:22 +03:00
|
|
|
@grep '^[^#[:space:]^\.PHONY.*].*:' Makefile
|
2018-10-16 00:37:10 +03:00
|
|
|
|
2018-10-16 01:39:22 +03:00
|
|
|
.PHONY: build
|
2018-10-16 00:37:10 +03:00
|
|
|
run: build
|
2017-07-15 03:00:52 +03:00
|
|
|
docker-compose -f docker/compose/docker-compose.yml -p $(NAME) up -d
|
|
|
|
|
2018-10-16 01:39:22 +03:00
|
|
|
# TODO? add custom test targets for individual tests (what used to be `multiple-tests` for example
|
|
|
|
# The docker files are still in docker/compose/docker*test*
|
|
|
|
.PHONY: test tests run-tests
|
|
|
|
test: run-tests
|
|
|
|
tests: run-tests
|
2018-10-16 00:37:10 +03:00
|
|
|
run-tests: build-tests
|
2018-10-16 01:39:22 +03:00
|
|
|
docker-compose -f tests/docker-compose.yml -p $(NAME) up -d
|
|
|
|
@echo "Waiting for the instance to come up..."
|
|
|
|
sleep 10
|
|
|
|
@echo "Running flake8.."
|
|
|
|
docker run -it mozdef_tester bash -c "source /opt/mozdef/envs/python/bin/activate && flake8 --config .flake8 ./"
|
|
|
|
@echo "Running py.test..."
|
|
|
|
docker run -it --network=mozdef_default mozdef_tester bash -c "source /opt/mozdef/envs/python/bin/activate && py.test --delete_indexes --delete_queues tests"
|
|
|
|
|
|
|
|
.PHONY: build
|
2018-10-16 00:37:10 +03:00
|
|
|
build:
|
2018-10-16 01:39:22 +03:00
|
|
|
docker-compose -f docker/compose/docker-compose.yml -p $(NAME) $(NO_CACHE) build
|
2017-07-15 03:00:52 +03:00
|
|
|
|
2018-10-16 01:39:22 +03:00
|
|
|
.PHONY: build-tests
|
2018-10-16 00:37:10 +03:00
|
|
|
build-tests:
|
2018-10-16 01:39:22 +03:00
|
|
|
docker-compose -f tests/docker-compose.yml -p $(NAME) $(NO_CACHE) build
|
2017-09-07 06:14:10 +03:00
|
|
|
|
2018-10-16 01:39:22 +03:00
|
|
|
.PHONY: stop down
|
|
|
|
stop: down
|
2018-10-16 00:37:10 +03:00
|
|
|
down:
|
2018-10-16 01:39:22 +03:00
|
|
|
docker-compose -f docker/compose/docker-compose.yml -p $(NAME) stop
|
2017-07-15 03:00:52 +03:00
|
|
|
|
2018-10-16 01:39:22 +03:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2017-10-11 01:24:55 +03:00
|
|
|
-docker-compose -f docker/compose/docker-compose.yml -p $(NAME) down -v --remove-orphans
|
|
|
|
|
2018-10-16 00:37:10 +03:00
|
|
|
# Shorthands
|
2018-10-16 01:39:22 +03:00
|
|
|
.PHONY: rebuild
|
|
|
|
rebuild: rm build
|