A tool to trigger Buildkite pipelines from a self-hosted Git repository.
You will need curl
and jq
installed on your host server.
The install.sh
script is currently user-specific, so you'll need to run it as the user you git push
with. This is typically the git
user.
You can provide the paths to your self-hosted Git repositories to the install script as arguments. This example uses one repo, /srv/git/example-project.git
.
ssh git@example.com
git init --bare /srv/git/example-project.git # If your repo isn't already set up
git clone --branch v1.2 https://nicholas.cloud/git/mandarin-duck.git
cd mandarin-duck
./install.sh /srv/git/example-project.git/
The project is installed to your home directory (~/.mandarin-duck/
), and a trigger is added as the post-receive
hook of each repository. You'll need to add some additional information to the ~/.mandarin-duck/mandarin-duck.cfg
configuration file.
Name | Description |
---|---|
buildkite_api_token |
Your Buildkite API token * |
buildkite_organization_slug |
The URL-friendly name of your Buildkite organization |
projects["/srv/git/example-project.git"].buildkite_pipeline_slug |
The URL-friendly name of this project's pipeline |
* You should create a new API token specifically for this project, and give it the write_builds
scope to trigger builds.
If you want to set up triggers for multiple Git repositories, re-run the install.sh
for each project. They will each be added to your configuration file.
To upgrade, you can re-run the install.sh
script. It will update the existing config, and make any necessary changes to your projects.
ssh git@example.com
cd mandarin-duck
git fetch --tags
git tag # find the latest verson
git checkout $LATEST_VERSION
./install.sh
There's a corresponding uninstall script to wipe all traces of mandarin-duck
from your server. It deletes the triggers it's created in each repositiroy, revokes the API token it's been using, and then deletes itself.
ssh git@example.com
cd mandarin-duck
./uninstall.sh
# clean up the source code too
cd ..
rm -rf mandarin-duck
For a full list of commits and changes, see the diff on GitHub.
- Fix environment variable from testing causing "unbound variable" errors in live installs.
- The install script now accepts multiple repos in a single command.
For a full list of commits and changes, see the diff on GitHub.
- The Buildkite API token stored in config will be automatically revoked on uninstall.
- Using the
[skip ci]
/[ci skip]
keyword in a commit will prevent a build being triggered. - Builds will no longer be triggered on deleted branches.
- You can automatically upgrade by running
./install.sh
!
Initial release. Hello world!