BigW Consortium Gitlab

_index.html.haml 3.37 KB
Newer Older
Phil Hughes committed
1 2 3
.row.prepend-top-default.append-bottom-default
  .col-lg-3
    %h4.prepend-top-0
4
      Triggers
5 6 7 8 9 10
    %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
11
  .col-lg-9
12 13 14 15 16 17 18 19 20 21 22 23 24 25
    .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
26
              = render partial: 'projects/triggers/trigger', collection: @triggers, as: :trigger
27 28 29
        - else
          %p.settings-message.text-center.append-bottom-default
            No triggers have been created yet. Add one using the button below.
30

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

34
      .panel-footer
35

36 37 38 39 40 41 42 43 44 45 46
        %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.
47

48 49
        %h5.prepend-top-default
          Use cURL
50

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

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

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

70 71 72 73 74 75
        %pre
          :plain
            trigger_build:
              stage: deploy
              script:
                - "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
76 77 78 79 80 81 82 83 84 85
        %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
86
        %h5.prepend-top-default
Filipa Lacerda committed
87
          Pass job variables
88 89 90 91

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

94 95 96
          With cURL:

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

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