blob: dee86886fb63e9c392f4924061284e3e8f6a165d [file] [log] [blame]
Andy Bavier614af142020-08-07 14:49:56 -07001# Copyright 2020-present Open Networking Foundation
2#
Jeremy Ronquillo71edcb72021-06-01 12:50:58 -07003# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Andy Bavier614af142020-08-07 14:49:56 -07004
5# Secret iCal URL for ACE downtime calendar
6SECRET_ICAL_URL ?=
7
8# Namespace to install secret in, for testing
9NAMESPACE ?= edge-monitoring
10
11# set default shell
12SHELL = bash -e -o pipefail
13
14# Variables
Andy Bavier55dc5872021-05-05 11:31:42 -070015VERSION ?= $(shell cat ../VERSION)
Andy Bavier614af142020-08-07 14:49:56 -070016VENVDIR := venv
17
18## Docker related
19DOCKER_REGISTRY ?=
20DOCKER_REPOSITORY ?=
21DOCKER_BUILD_ARGS ?=
22DOCKER_TAG ?= ${VERSION}
23ADAPTER_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
27help:
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
40build: docker-build
41
42docker-build:
43 docker build $(DOCKER_BUILD_ARGS) \
44 -t ${ADAPTER_IMAGENAME} \
45 -f ./Dockerfile.server .
46
47docker-push:
48 docker push ${ADAPTER_IMAGENAME}
49
Andy Bavier55dc5872021-05-05 11:31:42 -070050${VENVDIR}: requirements.txt
51 python3 -m venv ${VENVDIR};\
Andy Bavier614af142020-08-07 14:49:56 -070052 source ./${VENVDIR}/bin/activate ; set -u ;\
Andy Bavier55dc5872021-05-05 11:31:42 -070053 pip install --upgrade pip wheel setuptools;\
54 python3 --version; pip --version; \
Andy Bavier614af142020-08-07 14:49:56 -070055 pip install -r requirements.txt
56
57clean:
58 find . -name '*.pyc' | xargs rm -f
59
60distclean: clean
61 rm -rf ${VENVDIR}
62
63test: venv
64 source ./${VENVDIR}/bin/activate ; set -u ;\
65 python3 test_edge_monitoring_server.py