Safer curl invocation in CI documentation for pipeline triggers
Problem to solve
The CI documentation — both global (e.g. https://docs.gitlab.com/ee/ci/triggers/) and in the CI/CD settings page (/-/settings/ci_cd
) — suggests using curl to trigger CI pipelines using curl
like this:
trigger_build:
stage: deploy
script:
- "curl -X POST -F token=TOKEN -F ref=REF_NAME https://gitlab.example.org/api/v4/projects/1/trigger/pipeline"
Proposal
- Adding
--fail
will ensure that curl exits with an error code when the trigger fails - Adding
--silent
will avoid some log noise showing the progress timing & performance of the HTTP request