[CORD-2913] Add Makefile to test JJB jobs locally and README describing
how to use them.

Change-Id: I663f332f8076d00a22231d7bfd535578ac3b153f
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ab690d9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+# Makefile for testing JJB jobs in a virtualenv
+
+.PHONY: test clean
+
+VENV_DIR      ?= venv-jjb
+JJB_VERSION   ?= 2.0.0
+JOBCONFIG_DIR ?= job-configs
+
+$(VENV_DIR):
+	@echo "Setting up virtualenv for JJB testing"
+	virtualenv $@
+	$@/bin/pip install jenkins-job-builder==$(JJB_VERSION) pipdeptree
+
+$(JOBCONFIG_DIR):
+	mkdir $@
+
+test: $(VENV_DIR) $(JOBCONFIG_DIR)
+	source $(VENV_DIR)/bin/activate ; \
+	pipdeptree ; \
+	jenkins-jobs -l DEBUG test --recursive -o $(JOBCONFIG_DIR) jjb/ ;
+
+clean:
+	rm -rf $(VENV_DIR) $(JOBCONFIG_DIR)