blob: 9cbcef01e3c7bc91c58e6ee7de47f62bd13ff588 [file] [log] [blame]
Andy Bavier614af142020-08-07 14:49:56 -07001# Copyright 2020-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Secret iCal URL for ACE downtime calendar
16SECRET_ICAL_URL ?=
17
18# Namespace to install secret in, for testing
19NAMESPACE ?= edge-monitoring
20
21# set default shell
22SHELL = bash -e -o pipefail
23
24# Variables
Andy Bavier55dc5872021-05-05 11:31:42 -070025VERSION ?= $(shell cat ../VERSION)
Andy Bavier614af142020-08-07 14:49:56 -070026VENVDIR := venv
27
28## Docker related
29DOCKER_REGISTRY ?=
30DOCKER_REPOSITORY ?=
31DOCKER_BUILD_ARGS ?=
32DOCKER_TAG ?= ${VERSION}
33ADAPTER_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}edge-monitoring-server:${DOCKER_TAG}
34
35
36# This should to be the first and default target in this Makefile
37help:
38 @echo "Usage: make [<target>]"
39 @echo "where available targets are:"
40 @echo
41 @echo "build : Build the edge-monitoring-server docker image"
42 @echo "help : Print this help"
43 @echo "docker-push : Push the docker image to an external repository"
44 @echo "venv : Build local Python virtualenv"
45 @echo "test : Run edge-monitoring-server unit tests"
46 @echo "clean : Remove files created by the build and tests"
47 @echo "distclean : Remove venv directory"
48 @echo
49
50build: docker-build
51
52docker-build:
53 docker build $(DOCKER_BUILD_ARGS) \
54 -t ${ADAPTER_IMAGENAME} \
55 -f ./Dockerfile.server .
56
57docker-push:
58 docker push ${ADAPTER_IMAGENAME}
59
Andy Bavier55dc5872021-05-05 11:31:42 -070060${VENVDIR}: requirements.txt
61 python3 -m venv ${VENVDIR};\
Andy Bavier614af142020-08-07 14:49:56 -070062 source ./${VENVDIR}/bin/activate ; set -u ;\
Andy Bavier55dc5872021-05-05 11:31:42 -070063 pip install --upgrade pip wheel setuptools;\
64 python3 --version; pip --version; \
Andy Bavier614af142020-08-07 14:49:56 -070065 pip install -r requirements.txt
66
67clean:
68 find . -name '*.pyc' | xargs rm -f
69
70distclean: clean
71 rm -rf ${VENVDIR}
72
73test: venv
74 source ./${VENVDIR}/bin/activate ; set -u ;\
75 python3 test_edge_monitoring_server.py