blob: 0fc83de47ec0b41c5f08246a7390173a5b902bee [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
25VERSION ?= $(shell cat ./VERSION)
26VENVDIR := 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
60venv: ${VENVDIR}
61 virtualenv --python=python3.7 ${VENVDIR};\
62 source ./${VENVDIR}/bin/activate ; set -u ;\
63 pip install -r requirements.txt
64
65clean:
66 find . -name '*.pyc' | xargs rm -f
67
68distclean: clean
69 rm -rf ${VENVDIR}
70
71test: venv
72 source ./${VENVDIR}/bin/activate ; set -u ;\
73 python3 test_edge_monitoring_server.py