2017-03-07 08:02:56 -05:00
|
|
|
.row.prepend-top-default.append-bottom-default.triggers-container
|
2017-09-06 11:38:13 -04:00
|
|
|
.col-lg-12
|
2017-03-07 08:02:56 -05:00
|
|
|
= render "projects/triggers/content"
|
2016-09-06 04:36:04 -04:00
|
|
|
.panel.panel-default
|
|
|
|
.panel-heading
|
|
|
|
%h4.panel-title
|
|
|
|
Manage your project's triggers
|
|
|
|
.panel-body
|
2017-03-07 08:02:56 -05:00
|
|
|
= render "projects/triggers/form", btn_text: "Add trigger"
|
|
|
|
%hr
|
2016-09-06 04:36:04 -04:00
|
|
|
- if @triggers.any?
|
2017-03-07 08:02:56 -05:00
|
|
|
.table-responsive.triggers-list
|
2016-09-06 04:36:04 -04:00
|
|
|
%table.table
|
|
|
|
%thead
|
|
|
|
%th
|
|
|
|
%strong Token
|
2017-03-07 08:02:56 -05:00
|
|
|
%th
|
|
|
|
%strong Description
|
|
|
|
%th
|
|
|
|
%strong Owner
|
2016-09-06 04:36:04 -04:00
|
|
|
%th
|
|
|
|
%strong Last used
|
|
|
|
%th
|
2017-01-03 18:57:55 -05:00
|
|
|
= render partial: 'projects/triggers/trigger', collection: @triggers, as: :trigger
|
2016-09-06 04:36:04 -04:00
|
|
|
- else
|
|
|
|
%p.settings-message.text-center.append-bottom-default
|
2017-03-07 08:02:56 -05:00
|
|
|
No triggers have been created yet. Add one using the form above.
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
.panel-footer
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
%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-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
%h5.prepend-top-default
|
|
|
|
Use cURL
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
%p.light
|
|
|
|
Copy one of the tokens above, set your branch or tag name, and that
|
|
|
|
reference will be rebuilt.
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
%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
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
%p.light
|
|
|
|
In the
|
|
|
|
%code .gitlab-ci.yml
|
|
|
|
of another project, include the following snippet.
|
2017-02-10 13:13:15 -05:00
|
|
|
The project will be rebuilt at the end of the pipeline.
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-09-06 04:36:04 -04:00
|
|
|
%pre
|
|
|
|
:plain
|
|
|
|
trigger_build:
|
|
|
|
stage: deploy
|
|
|
|
script:
|
|
|
|
- "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
|
2016-11-07 12:11:54 -05:00
|
|
|
%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
|
2016-09-06 04:36:04 -04:00
|
|
|
%h5.prepend-top-default
|
2017-01-25 11:14:58 -05:00
|
|
|
Pass job variables
|
2016-09-06 04:36:04 -04:00
|
|
|
|
|
|
|
%p.light
|
|
|
|
Add
|
|
|
|
%code variables[VARIABLE]=VALUE
|
2017-02-10 13:13:15 -05:00
|
|
|
to an API request. Variable values can be used to distinguish between triggered pipelines and normal pipelines.
|
2016-09-06 04:36:04 -04:00
|
|
|
|
2016-11-07 12:11:54 -05:00
|
|
|
With cURL:
|
|
|
|
|
|
|
|
%pre
|
2016-09-06 04:36:04 -04:00
|
|
|
:plain
|
|
|
|
curl -X POST \
|
|
|
|
-F token=TOKEN \
|
|
|
|
-F "ref=REF_NAME" \
|
|
|
|
-F "variables[RUN_NIGHTLY_BUILD]=true" \
|
|
|
|
#{builds_trigger_url(@project.id)}
|
2016-11-07 12:11:54 -05:00
|
|
|
%p.light
|
|
|
|
With webhook:
|
|
|
|
|
|
|
|
%pre.append-bottom-0
|
|
|
|
:plain
|
|
|
|
#{builds_trigger_url(@project.id, ref: 'REF_NAME')}?token=TOKEN&variables[RUN_NIGHTLY_BUILD]=true
|