Commit ffbb9f74 by Ned Batchelder

Better modularization of makefiles

Help descriptions are in their own files.
parent a8d2c5a5
SHELL := /bin/bash
.PHONY: help requirements clean build test pkg
include *.mk
help: main.help
help:
main.help:
@echo ''
@echo 'Makefile for the edX Configuration'
@echo ''
......@@ -14,30 +14,9 @@ help:
@echo ' make pkg package everything'
@echo ' make clean remove build by-products'
@echo ''
@echo ' Docker:'
@echo ' $$image: any dockerhub image'
@echo ' $$container: any container defined in docker/build/$$container/Dockerfile'
@echo ''
@echo ' make $(docker_pull)$$image pull $$image from dockerhub'
@echo ''
@echo ' make $(docker_build)$$container build $$container'
@echo ' make $(docker_test)$$container test that $$container will build'
@echo ' make $(docker_pkg)$$container package $$container for a push to dockerhub'
@echo ' make $(docker_push)$$container push $$container to dockerhub '
@echo ''
@echo ' make docker.build build all defined docker containers (based on dockerhub base images)'
@echo ' make docker.test test all defined docker containers'
@echo ' make docker.pkg package all defined docker containers (using local base images)'
@echo ' make docker.push push all defined docker containers'
@echo ''
@echo ' Tests:'
@echo ' test.syntax Run all syntax tests'
@echo ' test.syntax.json Run syntax tests on .json files'
@echo ' test.syntax.yml Run syntax tests on .yml files'
@echo ' test.syntax.jinja Run syntax tests on .j2 files'
@echo ' test.edx_east_roles Run validation on edx-east roles'
@echo ''
requirements:
pip install -qr pre-requirements.txt --exists-action w
pip install -qr requirements.txt --exists-action w
include *.mk
......@@ -14,6 +14,26 @@ docker_test=docker.test.
docker_pkg=docker.pkg.
docker_push=docker.push.
help: docker.help
docker.help:
@echo ' Docker:'
@echo ' $$image: any dockerhub image'
@echo ' $$container: any container defined in docker/build/$$container/Dockerfile'
@echo ''
@echo ' $(docker_pull)$$image pull $$image from dockerhub'
@echo ''
@echo ' $(docker_build)$$container build $$container'
@echo ' $(docker_test)$$container test that $$container will build'
@echo ' $(docker_pkg)$$container package $$container for a push to dockerhub'
@echo ' $(docker_push)$$container push $$container to dockerhub '
@echo ''
@echo ' docker.build build all defined docker containers (based on dockerhub base images)'
@echo ' docker.test test all defined docker containers'
@echo ' docker.pkg package all defined docker containers (using local base images)'
@echo ' docker.push push all defined docker containers'
@echo ''
# N.B. / is used as a separator so that % will match the /
# in something like 'edxops/trusty-common:latest'
# Also, make can't handle ':' in filenames, so we instead '@'
......@@ -70,12 +90,12 @@ $(docker_push)%: $(docker_pkg)%
.build/%/Dockerfile.test: docker/build/%/Dockerfile Makefile
@mkdir -p .build/$*
# perl p (print the line) n (loop over every line) e (exec the regex), like sed but cross platform
@# perl p (print the line) n (loop over every line) e (exec the regex), like sed but cross platform
@perl -pne "s#FROM edxops/([^:]+)(:\S*)?#FROM \1:test#" $< > $@
.build/%/Dockerfile.pkg: docker/build/%/Dockerfile Makefile
@mkdir -p .build/$*
# perl p (print the line) n (loop over every line) e (exec the regex), like sed but cross platform
@# perl p (print the line) n (loop over every line) e (exec the regex), like sed but cross platform
@perl -pne "s#FROM edxops/([^:]+)(:\S*)?#FROM \1:test#" $< > $@
-include $(foreach image,$(images),.build/$(image)/Dockerfile.d)
yml_files:=$(shell find . -name "*.yml")
json_files:=$(shell find . -name "*.json")
# $(images) is calculated in the docker.mk file
help: test.help
test.help:
@echo ' Tests:'
@echo ' test.syntax Run all syntax tests'
@echo ' test.syntax.json Run syntax tests on .json files'
@echo ' test.syntax.yml Run syntax tests on .yml files'
@echo ' test.syntax.jinja Run syntax tests on .j2 files'
@echo ' test.edx_east_roles Run validation on edx-east roles'
@echo ''
test: test.syntax test.edx_east_roles
test.syntax: test.syntax.yml test.syntax.json test.syntax.dockerfiles
......@@ -19,7 +29,7 @@ test.syntax.json/%:
test.syntax.dockerfiles:
python util/check_dockerfile_coverage.py "$(images)"
test.edx_east_roles:
tests/test_edx_east_roles.sh
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment