BigW Consortium Gitlab

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

Phil Hughes committed
3 4 5 6
.row.prepend-top-default.append-bottom-default
  .col-lg-3
    %h4.prepend-top-0
      = page_title
7 8 9 10 11 12
    %p.prepend-top-20
      Triggers can force a specific branch or tag to get rebuilt with an API call.
    %p.append-bottom-0
      = succeed '.' do
        Learn more in the
        = link_to 'triggers documentation', help_page_path('ci/triggers/README'), target: '_blank'
Phil Hughes committed
13
  .col-lg-9
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
    .panel.panel-default
      .panel-heading
        %h4.panel-title
          Manage your project's triggers
      .panel-body
        - if @triggers.any?
          .table-responsive
            %table.table
              %thead
                %th
                  %strong Token
                %th
                  %strong Last used
                %th
              = render partial: 'trigger', collection: @triggers, as: :trigger
        - else
          %p.settings-message.text-center.append-bottom-default
            No triggers have been created yet. Add one using the button below.
32

33 34
        = form_for @trigger, url: url_for(controller: 'projects/triggers', action: 'create') do |f|
          = f.submit "Add trigger", class: 'btn btn-success'
35

36
      .panel-footer
37

38 39 40 41 42 43 44 45 46 47 48
        %p
          In the following examples, you can see the exact API call you need to
          make in order to rebuild a specific
          %code ref
          (branch or tag) with a trigger token.
        %p
          All you need to do is replace the
          %code TOKEN
          and
          %code REF_NAME
          with the trigger token and the branch or tag name respectively.
49

50 51
        %h5.prepend-top-default
          Use cURL
52

53 54 55
        %p.light
          Copy one of the tokens above, set your branch or tag name, and that
          reference will be rebuilt.
56

57 58 59 60 61 62 63 64
        %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
65

66 67 68 69 70
        %p.light
          In the
          %code .gitlab-ci.yml
          of another project, include the following snippet.
          The project will be rebuilt at the end of the build.
71

72 73 74 75 76 77
        %pre
          :plain
            trigger_build:
              stage: deploy
              script:
                - "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
78 79 80 81 82 83 84 85 86 87
        %h5.prepend-top-default
          Use webhook

        %p.light
          Add the following webhook to another project for Push and Tag push events.
          The project will be rebuilt at the corresponding event.

        %pre
          :plain
             #{builds_trigger_url(@project.id, ref: 'REF_NAME')}?token=TOKEN
88 89 90 91 92 93 94 95
        %h5.prepend-top-default
          Pass build variables

        %p.light
          Add
          %code variables[VARIABLE]=VALUE
          to an API request. Variable values can be used to distinguish between triggered builds and normal builds.

96 97 98
          With cURL:

        %pre
99 100 101 102 103 104
          :plain
            curl -X POST \
                 -F token=TOKEN \
                 -F "ref=REF_NAME" \
                 -F "variables[RUN_NIGHTLY_BUILD]=true" \
                 #{builds_trigger_url(@project.id)}
105 106 107 108 109 110
        %p.light
          With webhook:

        %pre.append-bottom-0
          :plain
             #{builds_trigger_url(@project.id, ref: 'REF_NAME')}?token=TOKEN&variables[RUN_NIGHTLY_BUILD]=true