Webhooks

Webhooks allow you to build or set up integrations which subscribe to certain events on Shipway. When one of those events is triggered, we'll send a HTTP POST payload to the webhook's configured URL. For example, webhooks can be post messages to a chat server or deploy containers to a Kubernetes cluster.

Each webhook can be installed on a specific respository. Once installed, they will be triggered each time a subscribed event occurs on that repository.

Shipway's webhook implementation is modeled after GitHub's webhook implementation.

Events

When configuring a webhook, you can choose which events you would like to receive payloads for.

There is currently only one available event:

Name Description
build_finish Any time a build finishes.

Payloads

Delivery headers

HTTP requests made to your webhook’s configured URL endpoint will contain several special headers:

Header Description
X-Shipway-Event Name of the event that triggered this delivery.
X-Shipway-Signature HMAC hex digest of the payload, using the hook’s secret as the key (if configured).
X-Shipway-Delivery Unique ID for this delivery.

Also, the User-Agent for the requests will have the prefix Shipway-Hookshot/.

Example delivery

POST /12r29j91 HTTP/1.1

Host: requestb.in
Content-Type: application/json
Content-Length: 6615
User-Agent: Shipway-Hookshot/0.1
X-Shipway-Delivery: 03bdf4a6-1a37-471a-861f-e52c35c2496a
X-Shipway-Event: build_finish
X-Shipway-Signature: sha1=7096366805db61cbe00c3bde2aea84e6c2faea7f

{
  "build": {
    "build_num": 14,
    "created_at": "2014-12-18T10:44:22+00:00",
    "dockerfile_dir": "/",
    "exit_code": 0,
    "status": "succeeded",
    "finished_at": "2014-12-18T10:47:42+00:00",
    "updated_at": "2014-12-18T10:44:22+00:00"
  },
  "commit": {
    "author": {
      "login": "grosskur",
      "name": "Alan Grosskurth"
    },
    "message": "Revert test commit",
    "sha": "88d543e33a67d669e917bb178d63fba838d9cf2e"
  },
  "image_tags": [
    {
      "full_name": "shipway.io/grosskur/docker-hello:latest",
      "id": "4cdd9808a0d64fc04e92be2832895ab2de9bf86dd60cf6d846e886904925186d",
      "name": "latest"
    }
  ],
  "images": [
    {
      "id": "4cdd9808a0d64fc04e92be2832895ab2de9bf86dd60cf6d846e886904925186d",
      "pushed": true
    },
    {
      "id": "aab4e5cb6c913c9801d1e0872f930d97b665edeb1344e01dd6e57daa9eefed15",
      "pushed": true
    },
    {
      "id": "d76986f1db3e3d98364088b98384d612ba5f8207cdf0575e5512da55d53c4490",
      "pushed": true
    },
    {
      "id": "60dbd5ce6f07db5d392da675f6ab1fadcea5c129d9853058dd487d55b3a655d3",
      "pushed": false
    },
    {
      "id": "fcf984186c72de37469b8a049f6bb4a3f128e9b60f3b3e279a9abbce689f6274",
      "pushed": false
    }
  ],
  "repository": {
    "clone_url": "https://github.com/grosskur/docker-hello.git",
    "id": 27844253,
    "name": "docker-hello",
    "owner": {
      "id": 40483,
      "login": "grosskur"
    }
  }
}