2015-11-26 14:37:03 +05:30
|
|
|
- page_title "Triggers"
|
2015-09-25 12:07:36 +05:30
|
|
|
%h3.page-title
|
|
|
|
Triggers
|
|
|
|
|
|
|
|
%p.light
|
|
|
|
Triggers can be used to force a rebuild of a specific branch or tag with an API call.
|
|
|
|
|
|
|
|
%hr.clearfix
|
|
|
|
|
|
|
|
-if @triggers.any?
|
2015-11-26 14:37:03 +05:30
|
|
|
.table-holder
|
|
|
|
%table.table
|
|
|
|
%thead
|
|
|
|
%th Token
|
|
|
|
%th Last used
|
|
|
|
%th
|
|
|
|
= render partial: 'trigger', collection: @triggers, as: :trigger
|
2015-09-25 12:07:36 +05:30
|
|
|
- else
|
|
|
|
%h4 No triggers
|
|
|
|
|
2015-10-24 18:46:33 +05:30
|
|
|
= form_for @trigger, url: url_for(controller: 'projects/triggers', action: 'create'), html: { class: 'form-horizontal' } do |f|
|
2015-09-25 12:07:36 +05:30
|
|
|
.clearfix
|
|
|
|
= f.submit "Add Trigger", class: 'btn btn-success pull-right'
|
|
|
|
|
|
|
|
%hr.clearfix
|
|
|
|
|
|
|
|
-if @triggers.any?
|
|
|
|
%h3
|
|
|
|
Use CURL
|
|
|
|
|
|
|
|
%p.light
|
|
|
|
Copy the token above and set your branch or tag name. This is the reference that will be rebuild.
|
|
|
|
|
|
|
|
|
|
|
|
%pre
|
|
|
|
:plain
|
|
|
|
curl -X POST \
|
|
|
|
-F token=TOKEN \
|
2015-12-23 02:04:40 +05:30
|
|
|
-F ref=REF_NAME \
|
|
|
|
#{builds_trigger_url(@project.id)}
|
2015-09-25 12:07:36 +05:30
|
|
|
%h3
|
|
|
|
Use .gitlab-ci.yml
|
|
|
|
|
|
|
|
%p.light
|
|
|
|
Copy the snippet to
|
|
|
|
%i .gitlab-ci.yml
|
|
|
|
of dependent project.
|
|
|
|
At the end of your build it will trigger this project to rebuilt.
|
|
|
|
|
|
|
|
%pre
|
|
|
|
:plain
|
|
|
|
trigger:
|
|
|
|
type: deploy
|
|
|
|
script:
|
2015-12-23 02:04:40 +05:30
|
|
|
- "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
|
2015-09-25 12:07:36 +05:30
|
|
|
%h3
|
|
|
|
Pass build variables
|
|
|
|
|
|
|
|
%p.light
|
|
|
|
Add
|
|
|
|
%strong variables[VARIABLE]=VALUE
|
|
|
|
to API request.
|
|
|
|
The value of variable could then be used to distinguish triggered build from normal one.
|
|
|
|
|
|
|
|
%pre
|
|
|
|
:plain
|
|
|
|
curl -X POST \
|
|
|
|
-F token=TOKEN \
|
2015-12-23 02:04:40 +05:30
|
|
|
-F "ref=REF_NAME" \
|
2015-09-25 12:07:36 +05:30
|
|
|
-F "variables[RUN_NIGHTLY_BUILD]=true" \
|
2015-12-23 02:04:40 +05:30
|
|
|
#{builds_trigger_url(@project.id)}
|