Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 1 | # Makefile for testing JJB jobs in a virtualenv |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 2 | .PHONY: test clean |
| 3 | |
Matteo Scandolo | 08900f7 | 2021-09-07 15:01:10 -0700 | [diff] [blame] | 4 | SHELL = bash -e -o pipefail |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 5 | VENV_DIR ?= venv-jjb |
Zack Williams | ccc1474 | 2020-01-22 13:15:59 -0700 | [diff] [blame] | 6 | JJB_VERSION ?= 3.2.0 |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 7 | JOBCONFIG_DIR ?= job-configs |
| 8 | |
| 9 | $(VENV_DIR): |
| 10 | @echo "Setting up virtualenv for JJB testing" |
Zack Williams | be54231 | 2022-06-23 21:51:32 -0700 | [diff] [blame] | 11 | python3 -m venv $@ |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 12 | $@/bin/pip install jenkins-job-builder==$(JJB_VERSION) pipdeptree |
| 13 | |
| 14 | $(JOBCONFIG_DIR): |
| 15 | mkdir $@ |
| 16 | |
Zack Williams | 9ac51db | 2018-04-16 16:44:24 -0700 | [diff] [blame] | 17 | lint: |
| 18 | yamllint -c yamllint.conf jjb/ |
| 19 | |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 20 | test: $(VENV_DIR) $(JOBCONFIG_DIR) |
| 21 | source $(VENV_DIR)/bin/activate ; \ |
| 22 | pipdeptree ; \ |
Zack Williams | 1c5c525 | 2018-04-20 13:50:44 -0700 | [diff] [blame] | 23 | jenkins-jobs -l DEBUG test --recursive --config-xml -o $(JOBCONFIG_DIR) jjb/ ; |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 24 | |
| 25 | clean: |
| 26 | rm -rf $(VENV_DIR) $(JOBCONFIG_DIR) |