Static Jenkins Site Generator
- Private Jenkins job scraping w/API key
- Added Gilroy font to match main public website
- Link back to ONF website for products
- Add more products
Change-Id: I3ed2dc1e371c564ee483ab83fd110a88d818bca7
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c2c756a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,74 @@
+# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+SHELL = bash -e -o pipefail
+
+# Common set of args, set to --debug for more output
+COMMON_ARGS ?= --debug
+
+# tooling binaries
+VIRTUALENV ?= virtualenv -p python3
+PYTHON ?= python3
+# change to be 'python3 -m cProfile -s cumtime' to profile a script
+
+.DEFAULT_GOAL := help
+.PHONY: test lint yamllint license help build siterender buildcollector sync
+
+# Create the virtualenv with all the tools installed
+VENV_NAME = venv_sjsg
+
+$(VENV_NAME): requirements.txt
+ $(VIRTUALENV) $@ ;\
+ source ./$@/bin/activate ; set -u ;\
+ $(PYTHON) -m pip install -r requirements.txt yamllint
+ echo "To enter virtualenv, run 'source $@/bin/activate'"
+
+# build targets
+
+build: buildcollector siterender ## Collect build info and create website
+
+buildcollector: $(VENV_NAME) ## Collect build information from Jenkins jobs
+ source ./$</bin/activate ; set -u ;\
+ $(PYTHON) buildcollector.py scrape.yaml --credentials credentials.yaml $(COMMON_ARGS)
+
+siterender: $(VENV_NAME) ## Create static website from build information
+ source ./$</bin/activate ; set -u ;\
+ $(PYTHON) siterender.py $(COMMON_ARGS)
+ cp -r static/* site/
+
+serve:
+ cd site && $(PYTHON) -m http.server
+
+sync:
+ rsync --delete-after -avP site/ ubuntu@static.opennetworking.org:/srv/sites/certification.opennetworking.org/
+
+# testing targets
+test: yamllint tox ## run all tests
+
+# YAML files, excluding venv and cookiecutter directories
+YAML_FILES ?= $(shell find . -type d \( -path "./venv_sjsc" \) -prune -o -type f \( -name '*.yaml' -o -name '*.yml' \) -print )
+
+yamllint: $(VENV_NAME) ## lint YAML format using yamllint
+ source ./$</bin/activate ; set -u ;\
+ yamllint --version ;\
+ yamllint \
+ -d "{extends: default, rules: {line-length: {max: 139}}}" \
+ -s $(YAML_FILES)
+
+tox: ## test code with tox
+ tox
+
+license: ## Check code for licensing with REUSE
+ reuse --root . lint
+
+clean: ## Delete all temporary files
+ rm -rf products/* site/*
+
+clean-all: clean ## Delete virtualenv and all cached job information
+ rm -rf $(VENV_NAME) jobs/* .tox
+
+help: ## Print help for each target
+ @echo nginx test targets
+ @echo
+ @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
+ | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'