Extends the CircleCI REST API with deterministic / bookmarkable URLs for:
- latest build on a specific branch
- build artifact download links
The circleci-redirector acts as a drop-in replacement for all GET requests to the CircleCI REST API. It adds a few new URL patterns (see below), but still supports the old ones.
Note that every request is responded with a HTTP 302 redirect to a specific build on CircleCI, so whenever you use this API ensure that your HTTP client follows redirects.
A public instance of circleci-redirector is running here:
It is being auto-deployed whenever something is committed to master
. Feel free to use it as-is, or fork this repo and deploy it on your own if you want more control.
Get redirected to the latest build on a specific branch:
GET /api/v1/project/<user>/<project>/tree/<branch>/latest
Get redirected to the test results for the latest build on a specific branch:
GET /api/v1/project/<user>/<project>/tree/<branch>/latest/tests
Get redirected to the list of build artifacts for the latest build on a specific branch:
GET /api/v1/project/<user>/<project>/tree/<branch>/latest/artifacts
Get redirected to the download link of a specific build artifact:
GET /api/v1/project/<user>/<project>/tree/<branch>/latest/artifacts/<artifact>
Every other GET request to /api/v1/*
which does not match the above patterns is being HTTP 302 redirected to the CircleCI REST API as-is, which means you can use it as a drop-in replacement if you want.
POST and DELETE requests are currently not forwarded or redirected.
All request parameters are preserved when redirecting to the CircleCI API, which also includes the authentication tokens (circle-token=1234...
) which the CircleCI REST API uses.
Whenever you need to transmit sensitive data such as authentication tokens, please:
- use https only
- consider using per-project auth tokens with limited access
- consider running your own circleci-redirector
Install the gem dependencies:
$ bundle install
Bring up the sinatra webapp in development mode (with automatic reloading):
$ rackup
Access the webapp in your browser, hack and reload:
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Make sure specs are passing (rake spec)
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request