summaryrefslogtreecommitdiff
path: root/app/views/projects/triggers/_index.html.haml
blob: 4f39c8396305e4488e3d391ac40270c1920f1c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
.row.gl-mt-3.gl-mb-3.triggers-container
  .col-lg-12
    .card
      .card-header
        Manage your project's triggers
      .card-body
        = render "projects/triggers/form", btn_text: "Add trigger"
        %hr
        - if Feature.enabled?(:ci_pipeline_triggers_settings_vue_ui, @project)
          #js-ci-pipeline-triggers-list.triggers-list{ data: { triggers: @triggers_json } }
        - else
          - if @triggers.any?
            .table-responsive.triggers-list
              %table.table
                %thead
                  %th
                    %strong Token
                  %th
                    %strong Description
                  %th
                    %strong Owner
                  %th
                    %strong Last used
                  %th
                = render partial: 'projects/triggers/trigger', collection: @triggers, as: :trigger
          - else
            %p.settings-message.text-center.gl-mb-3{ data: { testid: 'no_triggers_content' } }
              No triggers have been created yet. Add one using the form above.

      .card-footer

        %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.

        %h5.gl-mt-3
          Use cURL

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

        %pre
          :plain
            curl -X POST \
                 -F token=TOKEN \
                 -F ref=REF_NAME \
                 #{builds_trigger_url(@project.id)}
        %h5.gl-mt-3
          Use .gitlab-ci.yml

        %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 pipeline.

        %pre
          :plain
            trigger_build:
              stage: deploy
              script:
                - "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
        %h5.gl-mt-3
          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
        %h5.gl-mt-3
          Pass job variables

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

          With cURL:

        %pre
          :plain
            curl -X POST \
                 -F token=TOKEN \
                 -F "ref=REF_NAME" \
                 -F "variables[RUN_NIGHTLY_BUILD]=true" \
                 #{builds_trigger_url(@project.id)}
        %p.light
          With webhook:

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