debian-mirror-gitlab/app/views/projects/triggers/_index.html.haml

102 lines
3 KiB
Text
Raw Normal View History

2020-07-28 23:09:34 +05:30
.row.gl-mt-3.gl-mb-3.triggers-container
2018-03-17 18:26:18 +05:30
.col-lg-12
2018-11-08 19:23:39 +05:30
.card
.card-header
2018-12-13 13:39:08 +05:30
Manage your project's triggers
2018-11-08 19:23:39 +05:30
.card-body
2017-08-17 22:00:37 +05:30
= render "projects/triggers/form", btn_text: "Add trigger"
%hr
2016-09-29 09:46:39 +05:30
- if @triggers.any?
2017-08-17 22:00:37 +05:30
.table-responsive.triggers-list
2016-09-29 09:46:39 +05:30
%table.table
%thead
%th
%strong Token
2017-08-17 22:00:37 +05:30
%th
%strong Description
%th
%strong Owner
2016-09-29 09:46:39 +05:30
%th
%strong Last used
%th
2017-08-17 22:00:37 +05:30
= render partial: 'projects/triggers/trigger', collection: @triggers, as: :trigger
2016-09-29 09:46:39 +05:30
- else
2020-07-28 23:09:34 +05:30
%p.settings-message.text-center.gl-mb-3
2017-08-17 22:00:37 +05:30
No triggers have been created yet. Add one using the form above.
2015-09-25 12:07:36 +05:30
2018-11-08 19:23:39 +05:30
.card-footer
2015-09-25 12:07:36 +05:30
2016-09-29 09:46:39 +05:30
%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.
2015-09-25 12:07:36 +05:30
2020-07-28 23:09:34 +05:30
%h5.gl-mt-3
2016-09-29 09:46:39 +05:30
Use cURL
2015-09-25 12:07:36 +05:30
2016-09-29 09:46:39 +05:30
%p.light
Copy one of the tokens above, set your branch or tag name, and that
reference will be rebuilt.
2015-09-25 12:07:36 +05:30
2016-09-29 09:46:39 +05:30
%pre
:plain
curl -X POST \
-F token=TOKEN \
-F ref=REF_NAME \
#{builds_trigger_url(@project.id)}
2020-07-28 23:09:34 +05:30
%h5.gl-mt-3
2016-09-29 09:46:39 +05:30
Use .gitlab-ci.yml
2015-09-25 12:07:36 +05:30
2016-09-29 09:46:39 +05:30
%p.light
In the
%code .gitlab-ci.yml
of another project, include the following snippet.
2017-08-17 22:00:37 +05:30
The project will be rebuilt at the end of the pipeline.
2015-09-25 12:07:36 +05:30
2016-09-29 09:46:39 +05:30
%pre
:plain
trigger_build:
stage: deploy
script:
- "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
2020-07-28 23:09:34 +05:30
%h5.gl-mt-3
2017-08-17 22:00:37 +05:30
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
2020-07-28 23:09:34 +05:30
%h5.gl-mt-3
2017-08-17 22:00:37 +05:30
Pass job variables
2016-09-29 09:46:39 +05:30
%p.light
Add
%code variables[VARIABLE]=VALUE
2017-08-17 22:00:37 +05:30
to an API request. Variable values can be used to distinguish between triggered pipelines and normal pipelines.
2016-09-29 09:46:39 +05:30
2017-08-17 22:00:37 +05:30
With cURL:
%pre
2016-09-29 09:46:39 +05:30
:plain
curl -X POST \
-F token=TOKEN \
-F "ref=REF_NAME" \
-F "variables[RUN_NIGHTLY_BUILD]=true" \
#{builds_trigger_url(@project.id)}
2017-08-17 22:00:37 +05:30
%p.light
With webhook:
2020-06-23 00:09:42 +05:30
%pre.gl-mb-0
2017-08-17 22:00:37 +05:30
:plain
#{builds_trigger_url(@project.id, ref: 'REF_NAME')}?token=TOKEN&variables[RUN_NIGHTLY_BUILD]=true