Triggers
Start pipeline runs on pushes, pull requests, tags, a schedule, by hand with inputs, from another system's webhook, or when another pipeline finishes.
The on: block of the pipeline file decides when a pipeline runs. You can edit it in the file or on
the pipeline's Triggers tab, which writes the same keys and saves them as a commit or a pull
request.
on:
push:
branches: [main, release/*]
paths-ignore: [docs/**]
pull_request:
branches: [main]
drafts: false
tags: [v*]
schedule:
- cron: "0 2 * * *" # UTC
branch: main
manual: true
webhook: true
pipeline_completed:
- pipeline: infrastructure
when: successWithout on:, a pipeline only runs by hand.
Push
Runs when commits are pushed to matching branches.
| Option | Meaning |
|---|---|
branches | Branches to run on. Globs work: release/*, or * for every branch |
branches-ignore | Branches to leave out |
paths | Run only when the push touches these paths |
paths-ignore | Don't run when the push only touches these paths |
Pull requests
Runs on pull requests (merge requests on GitLab) opened or updated against the target branches, and
reports the result on the pull request. Also takes paths and paths-ignore. With drafts: false
(the default), draft pull requests start a run when they're marked ready for review.
Pull requests from forks get only the secrets marked for forks, can't use self-hosted runners and never deploy to protected environments.
Tags
tags: [v*] runs when a matching tag is pushed: v* matches v1.4.0 and v2.0.0-rc.1. tags: true
runs on every tag.
Schedule
Each cron has 5 fields and runs in UTC on the latest commit of branch (the default branch when
left out). 0 2 * * * is every day at 02:00 UTC.
Manual runs and inputs
manual: true lets people who can run pipelines start it with Run pipeline. Inputs in the file
appear as a form and reach jobs as $inputs.NAME; see
inputs.
Webhook (API trigger)
webhook: true lets another system start a run with an HTTP request. On the Triggers tab, create
the webhook token (it's shown once; regenerating it stops the old one at once). The token only starts
this pipeline: it can't read logs or secrets.
curl -X POST https://api.infraista.com/api/pipelines/hooks/PIPELINE_ID \
-H "Authorization: Bearer iph_..." \
-H "Content-Type: application/json" \
-d '{"branch": "main", "inputs": {"target": "staging"}}'It answers 201 with the run number and its URL. branch and inputs are optional, and the file on
that branch must list webhook. Up to 30 requests a minute.
When another pipeline finishes
pipeline_completed starts this pipeline, on the head of its default branch, when a run of another
pipeline in the organization ends:
pipeline: the other pipeline's name;when:success,failureorcompleted;branches(optional): only for runs of these branches.
Chains stop after 3 pipelines.
Skipping a run
A commit whose message contains [skip ci], [ci skip], [no ci] or [skip pipelines] doesn't
start push or pull request runs. Scheduled, manual, webhook and pipeline-completion runs still start.
To ignore the markers, turn the option off in the pipeline's Settings.
Related
Runs and logs
Follow a pipeline run job by job, read and search its logs, re-run failed jobs, cancel a run, and see results on your commits and pull requests.
Secrets and variables
Store API keys, passwords and settings for your pipelines per organization, pipeline or environment, use them in the file, and edit them as a .env file.