BigW Consortium Gitlab

index.html.haml 1.91 KB
Newer Older
Kamil Trzcinski committed
1
- page_title "Triggers"
2

Phil Hughes committed
3 4 5 6 7
.row.prepend-top-default.append-bottom-default
  .col-lg-3
    %h4.prepend-top-0
      = page_title
    %p
8
      Triggers can force a specific branch or tag to rebuild with an API call.
Phil Hughes committed
9 10 11 12 13 14 15 16 17 18 19 20
  .col-lg-9
    %h5.prepend-top-0
      Your triggers
    - if @triggers.any?
      .table-responsive
        %table.table
          %thead
            %th Token
            %th Last used
            %th
          = render partial: 'trigger', collection: @triggers, as: :trigger
    - else
21
      %p.settings-message.text-center.append-bottom-default
22
        No triggers have been created yet. Add one using the button below.
23

Phil Hughes committed
24 25
    = form_for @trigger, url: url_for(controller: 'projects/triggers', action: 'create') do |f|
      = f.submit "Add Trigger", class: 'btn btn-success'
26

Phil Hughes committed
27 28
    %h5.prepend-top-default
      Use CURL
29

Phil Hughes committed
30
    %p.light
31
      Copy the token above, set your branch or tag name, and that reference will be rebuilt.
32

Phil Hughes committed
33 34 35 36 37 38 39 40
    %pre
      :plain
        curl -X POST \
             -F token=TOKEN \
             -F ref=REF_NAME \
             #{builds_trigger_url(@project.id)}
    %h5.prepend-top-default
      Use .gitlab-ci.yml
41

Phil Hughes committed
42
    %p.light
43 44 45 46
      In the
      %code .gitlab-ci.yml
      of the dependent project, include the following snippet.
      The project will rebuild at the end of the build.
47

Phil Hughes committed
48 49 50 51 52 53 54 55
    %pre
      :plain
        trigger:
          type: deploy
          script:
            - "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
    %h5.prepend-top-default
      Pass build variables
56

Phil Hughes committed
57 58
    %p.light
      Add
59
      %code variables[VARIABLE]=VALUE
60
      to an API request. Variable values can be used to distinguish between triggered builds and normal builds.
61

Phil Hughes committed
62 63 64 65 66 67 68
    %pre.append-bottom-0
      :plain
        curl -X POST \
             -F token=TOKEN \
             -F "ref=REF_NAME" \
             -F "variables[RUN_NIGHTLY_BUILD]=true" \
             #{builds_trigger_url(@project.id)}