Skip to content

Add a `pipeline hooks`

Currently as part of our notification system we have (https://gitlab.com/gitlab-org/gitlab-ce/hooks):Push events, Build events, etc.

We need to extend the Hooks with a Pipeline events a notification when a new pipeline is created, is updated (it's status changes) and does finishes.

Some parts of this commit is adding a build_events (for build hooks): https://gitlab.com/gitlab-org/gitlab-ce/commit/2988e1fbf50b3c9e803a9358933e3e969e64dcc3,

Here's an example to add wiki_page_events: https://gitlab.com/gitlab-org/gitlab-ce/commit/54661d3d44a7d98ed52680b074b2caed7aa33676.

We need to add a pipeline_events. I propose payload like this:

{
  "object_kind": "pipeline",
  "user": {
    "name": "Administrator",
    "username": "root",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
  },
  "project":{
    "name":"Gitlab Test",
    "description":"Aut reprehenderit ut est.",
    "web_url":"http://example.com/gitlabhq/gitlab-test",
    "avatar_url":null,
    "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
    "git_http_url":"http://example.com/gitlabhq/gitlab-test.git",
    "namespace":"GitlabHQ",
    "visibility_level":20,
    "path_with_namespace":"gitlabhq/gitlab-test",
    "default_branch":"master",
    "homepage":"http://example.com/gitlabhq/gitlab-test",
    "url":"http://example.com/gitlabhq/gitlab-test.git",
    "ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
    "http_url":"http://example.com/gitlabhq/gitlab-test.git"
  },
  "repository":{
    "name": "Gitlab Test",
    "url": "http://example.com/gitlabhq/gitlab-test.git",
    "description": "Aut reprehenderit ut est.",
    "homepage": "http://example.com/gitlabhq/gitlab-test"
  },
  "commit": {
    "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
    "message": "Update Catalan translation to e38cb41.",
    "timestamp": "2011-12-12T14:27:31+02:00",
    "url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
    "author": {
      "name": "Jordi Mallach",
      "email": "jordi@softcatala.org"
    }
  },
  "object_attributes": {
    "id": 301,
    "ref": "master",
    "tag": true,
    "sha": "12321321",
    "before_sha": "1234123",
    "status": "running",
    "stage": "test",
    "stages": ["build", "test", "deploy"],
    "created_at": "aa",
    "started_at": "aa",
    "finished_at": "aa",
  },
  "builds": [
    { "id": 133,
      "stage": "test",
      "name": "build",
      "status": "running",
      "created_at": "aa",
      "started_at": "aa",
      "finished_at": "aa",
      "when": "on_success",
      "manual": true,
      "user": {
        "name": "Administrator",
        "username": "root",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
      },
      "runner": {
        "id": 132,
        "description": "my runner",
        "active": true,
        "is_shared": true
      },
      "artifacts_file": {
        "filename": "artifacts.zip",
        "size": 1000
      }
    }
  ]
}

Where:

  1. object_attributes describe a attributes of pipeline
  2. object_attributes.stage describe a current stage which is running,

The pipeline event should be send:

  1. When Pipeline is created,
  2. When a pipeline status changes,
  3. When a pipeline finished (this would basically be done by 2.).