BigW Consortium Gitlab

index.html.haml 3.6 KB
- page_title "CI Web Hooks"
%h3.page-title
  CI Web hooks

%p.light
  Web Hooks can be used for binding events when build completed.

%hr.clearfix

= form_for @web_hook, url: namespace_project_ci_web_hooks_path(@project.namespace, @project), html: { class: 'form-horizontal' } do |f|
  -if @web_hook.errors.any?
    .alert.alert-danger
      - @web_hook.errors.full_messages.each do |msg|
        %p= msg
  .form-group
    = f.label :url, "URL", class: 'control-label'
    .col-sm-10
      = f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json'
  .form-actions
    = f.submit "Add Web Hook", class: "btn btn-create"

-if @web_hooks.any?
  %h4 Activated web hooks (#{@web_hooks.count})
  .table-holder
    %table.table
      - @web_hooks.each do |hook|
        %tr
          %td
            .clearfix
              %span.monospace= hook.url
          %td
            .pull-right
              - if @ci_project.commits.any?
                = link_to 'Test Hook', test_namespace_project_ci_web_hook_path(@project.namespace, @project, hook), class: "btn btn-sm btn-grouped"
              = link_to 'Remove', namespace_project_ci_web_hook_path(@project.namespace, @project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped"

%h4 Web Hook data example

:erb
  <pre>
    <code>
      {
        "build_id": 2,
        "build_name":"rspec_linux"
        "build_status": "failed",
        "build_started_at": "2014-05-05T18:01:02.563Z",
        "build_finished_at": "2014-05-05T18:01:07.611Z",
        "project_id": 1,
        "project_name": "Brightbox \/ Brightbox Cli",
        "gitlab_url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli",
        "ref": "master",
        "sha": "a26cf5de9ed9827746d4970872376b10d9325f40",
        "before_sha": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
        "push_data": {
          "before": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
          "after": "a26cf5de9ed9827746d4970872376b10d9325f40",
          "ref": "refs\/heads\/master",
          "user_id": 1,
          "user_name": "Administrator",
          "project_id": 5,
          "repository": {
            "name": "Brightbox Cli",
            "url": "dzaporozhets@localhost:brightbox\/brightbox-cli.git",
            "description": "Voluptatibus quae error consectetur voluptas dolores vel excepturi possimus.",
            "homepage": "http:\/\/localhost:3000\/brightbox\/brightbox-cli"
          },
          "commits": [
            {
              "id": "a26cf5de9ed9827746d4970872376b10d9325f40",
              "message": "Release v1.2.2",
              "timestamp": "2014-04-22T16:46:42+03:00",
              "url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli\/commit\/a26cf5de9ed9827746d4970872376b10d9325f40",
              "author": {
                "name": "Paul Thornthwaite",
                "email": "tokengeek@gmail.com"
              }
            },
            {
              "id": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
              "message": "Fix server user data update\n\nIncorrect condition was being used so Base64 encoding option was having\nopposite effect from desired.",
              "timestamp": "2014-04-11T18:17:26+03:00",
              "url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli\/commit\/34f57f6ba3ed0c21c5e361bbb041c3591411176c",
              "author": {
                "name": "Paul Thornthwaite",
                "email": "tokengeek@gmail.com"
              }
            }
          ],
          "total_commits_count": 2,
          "ci_yaml_file":"rspec_linux:\r\n  script: ls\r\n"
        }
      }
    </code>
  </pre>