| # Copyright 2020-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # Secret iCal URL for ACE downtime calendar |
| SECRET_ICAL_URL ?= |
| |
| # Namespace to install secret in, for testing |
| NAMESPACE ?= edge-monitoring |
| |
| # set default shell |
| SHELL = bash -e -o pipefail |
| |
| # Variables |
| VERSION ?= $(shell cat ../VERSION) |
| VENVDIR := venv |
| |
| ## Docker related |
| DOCKER_REGISTRY ?= |
| DOCKER_REPOSITORY ?= |
| DOCKER_BUILD_ARGS ?= |
| DOCKER_TAG ?= ${VERSION} |
| ADAPTER_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}edge-monitoring-server:${DOCKER_TAG} |
| |
| |
| # This should to be the first and default target in this Makefile |
| help: |
| @echo "Usage: make [<target>]" |
| @echo "where available targets are:" |
| @echo |
| @echo "build : Build the edge-monitoring-server docker image" |
| @echo "help : Print this help" |
| @echo "docker-push : Push the docker image to an external repository" |
| @echo "venv : Build local Python virtualenv" |
| @echo "test : Run edge-monitoring-server unit tests" |
| @echo "clean : Remove files created by the build and tests" |
| @echo "distclean : Remove venv directory" |
| @echo |
| |
| build: docker-build |
| |
| docker-build: |
| docker build $(DOCKER_BUILD_ARGS) \ |
| -t ${ADAPTER_IMAGENAME} \ |
| -f ./Dockerfile.server . |
| |
| docker-push: |
| docker push ${ADAPTER_IMAGENAME} |
| |
| ${VENVDIR}: requirements.txt |
| python3 -m venv ${VENVDIR};\ |
| source ./${VENVDIR}/bin/activate ; set -u ;\ |
| pip install --upgrade pip wheel setuptools;\ |
| python3 --version; pip --version; \ |
| pip install -r requirements.txt |
| |
| clean: |
| find . -name '*.pyc' | xargs rm -f |
| |
| distclean: clean |
| rm -rf ${VENVDIR} |
| |
| test: venv |
| source ./${VENVDIR}/bin/activate ; set -u ;\ |
| python3 test_edge_monitoring_server.py |