TreeScale
Search…
Webhooks
Handle Container Image "push" events from outside of TreeScale
Sometimes you need an integration between services and most of the Container CI, CD or Infrastructure environments expect to receive an HTTP request with the data of the container "push" event in order to trigger an action to pull a new container image or do something else. One of the best examples is Github Actions or Jenkins, where they expect to receive an HTTP Post request (or you can configure them) to trigger a new CI/CD pipeline to run your tests inside newly pushed container or just deploy a new version to Kubernetes production.

Setting Webhook

For better customisability at TreeScale we have an ability to set your WebHook URL for each repository individually. It is inside a Repository settings page and setting it as easy as juts typing a Webhook endpoint URL there. It has to be a valid URL, otherwise our system will start ignoring over time when it will fail requests few times in a row.
Individual Repository -> Settings page

JSON Payload

External integrated service should expect to receive an HTTP/S POST request with JSON body and some extra headers to identify request. You can also provide a URL query parameters to pass a token to your integrated service if you need to be sure only TreeScale can send an HTTP request to a given url.
1
User-Agent: TreeScale.com WebHook Handler
2
Accept-Encoding: gzip, deflate
3
Accept: */*
4
Connection: keep-alive
5
x-treescale-webhook: <username>/<repository>:<tag>
6
Content-Length: <size of JSON payload>
7
Content-Type: application/json
Copied!
JSON Body is not customisable the the moment, but it could be over time if there is a real need for that.
1
{
2
"image": "repo.treescale.com/<username>/<repository>:<tag>",
3
"image_size": <pushed image size>,
4
"layers": [<pushed image layers>],
5
"repository": "repo.treescale.com/<username>/<repository>",
6
"repository_size": <repository size>,
7
"event": "push",
8
"timestamp": <ISO formatted time of the request>
9
}
Copied!

Final Notes

It is important to know that our Webhook service sends a request asynchronously, which means that if you make a docker push it might take a few seconds to trigger a Webhook operation. That's because we want to make sure to not overload an integrated service with a blast of HTTP requests, so we batch them.
Last modified 6mo ago
Copy link