summaryrefslogtreecommitdiff
path: root/app/views/projects/triggers/_index.html.haml
blob: a7f29b5cbf9e26a6924b2027c365401b075c9a6a (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
.row.gl-mt-3.gl-mb-3
  .col-lg-12
    = render Pajamas::CardComponent.new do |c|
      - c.header do
        = _("Manage your project's triggers")
      - c.body do
        = render 'projects/triggers/form', btn_text: _('Add trigger')
        .gl-mb-5
        - 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
            = render Pajamas::AlertComponent.new(variant: :warning, show_icon: false, dismissible: false,
              alert_options: { data: { testid: 'no_triggers_content' }}) do |c|
              = c.body do
                = _('No triggers exist yet. Use the form above to create one.')
      - c.footer do
        %p
          = _("These examples show how to trigger this project's pipeline for a branch or tag.")

        %p.light
          = _('In each example, replace %{code_start}TOKEN%{code_end} with the trigger token you generated and replace %{code_start}REF_NAME%{code_end} with the branch or tag name.').html_safe % { code_start: '<code>'.html_safe, code_end: '</code>'.html_safe }

        %h5.gl-mt-3
          = _('Use cURL')

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

        %pre
          :plain
            script:
              - "curl -X POST --fail -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
        %h5.gl-mt-3
          = _('Use webhook')

        %pre
          :plain
            #{builds_trigger_url(@project.id, ref: 'REF_NAME')}?token=TOKEN
        %h5.gl-mt-3
          = _('Pass job variables')

        %p.light
          = _('To pass variables to the triggered pipeline, add %{code_start}variables[VARIABLE]=VALUE%{code_end} to the API request.').html_safe % { code_start: '<code>'.html_safe, code_end: '</code>'.html_safe }

        %p.light
          = _('cURL:')

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

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