- add_form_class = 'gl-display-none' if !form_errors(@trigger)
- hide_class = 'gl-display-none' if form_errors(@trigger)
.row.gl-mt-3.gl-mb-3
.col-lg-12
= render Pajamas::CardComponent.new(card_options: { class: 'gl-new-card js-toggle-container' }, header_options: { class: 'gl-new-card-header gl-flex-wrap gl-sm-flex-nowrap' }, body_options: { class: 'gl-new-card-body gl-px-0' }) do |c|
- c.with_header do
.gl-new-card-title-wrapper
%h5.gl-new-card-title
= _("Active pipeline trigger tokens")
.gl-new-card-count
= sprite_icon('token', css_class: 'gl-mr-2')
= @triggers.size
.gl-new-card-actions.gl-display-flex.gl-justify-content-end.gl-w-full.gl-sm-w-auto.gl-mt-3.gl-sm-mt-0
= render Pajamas::ButtonComponent.new(size: :small, category: :tertiary, button_options: { data: { testid: 'reveal-hide-values-button' } }) do
= _('Reveal values')
= render Pajamas::ButtonComponent.new(size: :small, button_options: { class: "gl-ml-2 js-toggle-button js-toggle-content #{hide_class}" }) do
= _('Add new token')
- c.with_body do
.gl-new-card-add-form.gl-m-3.js-toggle-content{ class: add_form_class }
%h4.gl-mt-0
= _('Add new pipeline trigger token')
= render 'projects/triggers/form', btn_text: _('Create pipeline trigger token'), show_cancel_button: true
#js-ci-pipeline-triggers-list.triggers-list{ data: { triggers: @triggers_json } }
%details.gl-mt-5.gl-border.gl-rounded-base
%summary.gl-py-3.gl-px-5.gl-font-weight-semibold
= _("View trigger token usage examples")
.gl-p-5
%p.gl-text-secondary
= _("These examples show common methods of triggering a pipeline with a pipeline trigger token. The URL and ID for this project is prefilled.")
%p.gl-text-secondary
= _('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: ''.html_safe, code_end: '
'.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.gl-text-secondary
= _('To pass variables to the triggered pipeline, add %{code_start}variables[VARIABLE]=VALUE%{code_end} to the API request.').html_safe % { code_start: ''.html_safe, code_end: '
'.html_safe }
%p.gl-text-secondary
= _('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.gl-text-secondary
= _('Webhook:')
%pre.gl-mb-0
:plain
#{builds_trigger_url(@project.id, ref: 'REF_NAME')}?token=TOKEN&variables[RUN_NIGHTLY_BUILD]=true