Example monorepo using third-party buildkite tool buildpipe.
The monorepo config lives in buildpipe.yml. You can see there are 3 projects defined and deploy steps only happen during Eastern time business hours.
The config shows steps the projects share with their associated commands. The commands are standardized using make
and Makefile inheritance.
- Create a pipeline adding the following initial step
buildpipe -i buildpipe.yml -o pipeline.yml buildkite-agent pipeline upload pipeline.yml
- Generate deploy key and change permissions
# Start ssh agent in the background eval "$(ssh-agent -s)" # Generate ssh key make generate-deploy-ssh-key chmod 600 ~/.ssh/id_rsa_buildkite_git # Create agent socket ssh-agent -a ~/.ssh/ssh-agent.sock # Add ssh key ssh-add ~/.ssh/id_rsa_buildkite_git # Test key works # https://developer.github.com/v3/guides/using-ssh-agent-forwarding/ ssh -T [email protected]
- Add the public key
~/.ssh/id_rsa_buildkite_git.pub
to your Github repo under Settings > Deploy keys. - Run the buildkite agents locally:
# Make sure to add to .bashrc export SSH_AUTH_SOCK=$HOME/.ssh/ssh-agent.sock export BUILDKITE_AGENT_TOKEN=<token> # Run agent in a docker container scaled to the number of cpus cd buildkite-agent/ && make local
You should see the number of agents at the top bar in Buildkite appear.
The following examples shows how the pipeline creation is dynamic depending on which projects were changed.