Andy Bavier | 614af14 | 2020-08-07 14:49:56 -0700 | [diff] [blame] | 1 | # Copyright 2020-present Open Networking Foundation |
| 2 | # |
Jeremy Ronquillo | 71edcb7 | 2021-06-01 12:50:58 -0700 | [diff] [blame^] | 3 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Andy Bavier | 614af14 | 2020-08-07 14:49:56 -0700 | [diff] [blame] | 4 | |
| 5 | # Secret iCal URL for ACE downtime calendar |
| 6 | SECRET_ICAL_URL ?= |
| 7 | |
| 8 | # Namespace to install secret in, for testing |
| 9 | NAMESPACE ?= edge-monitoring |
| 10 | |
| 11 | # set default shell |
| 12 | SHELL = bash -e -o pipefail |
| 13 | |
| 14 | # Variables |
Andy Bavier | 55dc587 | 2021-05-05 11:31:42 -0700 | [diff] [blame] | 15 | VERSION ?= $(shell cat ../VERSION) |
Andy Bavier | 614af14 | 2020-08-07 14:49:56 -0700 | [diff] [blame] | 16 | VENVDIR := venv |
| 17 | |
| 18 | ## Docker related |
| 19 | DOCKER_REGISTRY ?= |
| 20 | DOCKER_REPOSITORY ?= |
| 21 | DOCKER_BUILD_ARGS ?= |
| 22 | DOCKER_TAG ?= ${VERSION} |
| 23 | ADAPTER_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}edge-monitoring-server:${DOCKER_TAG} |
| 24 | |
| 25 | |
| 26 | # This should to be the first and default target in this Makefile |
| 27 | help: |
| 28 | @echo "Usage: make [<target>]" |
| 29 | @echo "where available targets are:" |
| 30 | @echo |
| 31 | @echo "build : Build the edge-monitoring-server docker image" |
| 32 | @echo "help : Print this help" |
| 33 | @echo "docker-push : Push the docker image to an external repository" |
| 34 | @echo "venv : Build local Python virtualenv" |
| 35 | @echo "test : Run edge-monitoring-server unit tests" |
| 36 | @echo "clean : Remove files created by the build and tests" |
| 37 | @echo "distclean : Remove venv directory" |
| 38 | @echo |
| 39 | |
| 40 | build: docker-build |
| 41 | |
| 42 | docker-build: |
| 43 | docker build $(DOCKER_BUILD_ARGS) \ |
| 44 | -t ${ADAPTER_IMAGENAME} \ |
| 45 | -f ./Dockerfile.server . |
| 46 | |
| 47 | docker-push: |
| 48 | docker push ${ADAPTER_IMAGENAME} |
| 49 | |
Andy Bavier | 55dc587 | 2021-05-05 11:31:42 -0700 | [diff] [blame] | 50 | ${VENVDIR}: requirements.txt |
| 51 | python3 -m venv ${VENVDIR};\ |
Andy Bavier | 614af14 | 2020-08-07 14:49:56 -0700 | [diff] [blame] | 52 | source ./${VENVDIR}/bin/activate ; set -u ;\ |
Andy Bavier | 55dc587 | 2021-05-05 11:31:42 -0700 | [diff] [blame] | 53 | pip install --upgrade pip wheel setuptools;\ |
| 54 | python3 --version; pip --version; \ |
Andy Bavier | 614af14 | 2020-08-07 14:49:56 -0700 | [diff] [blame] | 55 | pip install -r requirements.txt |
| 56 | |
| 57 | clean: |
| 58 | find . -name '*.pyc' | xargs rm -f |
| 59 | |
| 60 | distclean: clean |
| 61 | rm -rf ${VENVDIR} |
| 62 | |
| 63 | test: venv |
| 64 | source ./${VENVDIR}/bin/activate ; set -u ;\ |
| 65 | python3 test_edge_monitoring_server.py |