BigW Consortium Gitlab

_index.html.haml 3.16 KB
Newer Older
1
.row.prepend-top-default.append-bottom-default.triggers-container
Phil Hughes committed
2
  .col-lg-3
3
    = render "projects/triggers/content"
Phil Hughes committed
4
  .col-lg-9
5 6 7 8 9
    .panel.panel-default
      .panel-heading
        %h4.panel-title
          Manage your project's triggers
      .panel-body
10 11
        = render "projects/triggers/form", btn_text: "Add trigger"
        %hr
12
        - if @triggers.any?
13
          .table-responsive.triggers-list
14 15 16 17
            %table.table
              %thead
                %th
                  %strong Token
18 19 20 21
                %th
                  %strong Description
                %th
                  %strong Owner
22 23 24
                %th
                  %strong Last used
                %th
25
              = render partial: 'projects/triggers/trigger', collection: @triggers, as: :trigger
26 27
        - else
          %p.settings-message.text-center.append-bottom-default
28
            No triggers have been created yet. Add one using the form above.
29

30
      .panel-footer
31

32 33 34 35 36 37 38 39 40 41 42
        %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.
43

44 45
        %h5.prepend-top-default
          Use cURL
46

47 48 49
        %p.light
          Copy one of the tokens above, set your branch or tag name, and that
          reference will be rebuilt.
50

51 52 53 54 55 56 57 58
        %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
59

60 61 62 63
        %p.light
          In the
          %code .gitlab-ci.yml
          of another project, include the following snippet.
64
          The project will be rebuilt at the end of the pipeline.
65

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

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

90 91 92
          With cURL:

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

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