Drone 1.0 mono-repoistory

Hey,

like some others we also had a monorepo that we wanted to build with drone. We have create a drone plugin that walks up a directory tree and combines all drone ci files to a single multi-machine build.

To create the individual .drone.yml files we use Drone’s jsonnet plugin and a Makefile:

TARGETS = $(shell find -name .drone.json)
LINKS = $(TARGETS:.json=.jsonnet)
DRONE = $(TARGETS:.json=.yml)

all: links drone

clean:
	rm $(LINKS) $(DRONE) || true

links: $(LINKS)
$(LINKS):
	ln -s $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.drone.jsonnet $@

drone: $(DRONE)
$(DRONE):
	drone jsonnet --source=$(@:.yml=.jsonnet) --target=$@

In each directory we want a .drone.yml we place a .drone.json with some configuration options. The .drone.jsonnet will be run against each of the json files.

2 Likes