How to create custom external pipeline with Gitlab API?

I would like to create a custom “external pipeline” through the gitlab api.
Sort of like how an external CI service works, like Jenkins, A pipeline which is initiated by an external service using a webhook, and in the job info links to an external site.

Is there a way to do this? I searched the docs and haven’t found anything.

I think what you probably want is to write your own custom webhook

I’m unsure if this will satisfy your needs exactly.

If you are trying to trigger a Gitlab Job from an external site

Here is some documentation on triggering a GitLab pipeline with a POST call to the /projects/:id/trigger/pipeline API.

I’m unsure of the best way to handle including job info links to the external location but you could try to pass in a trigger variable that includes the link to the external job.

If you want a change to your Gitlab-hosted code to trigger an external pipeline service

You could attempt to follow the basic concept described here for Triggering a pipeline from a webhook.

You would have to setup and deploy your own webhook service that accepts and parses the information from a Push or Tag event as described in the link.

Found my solution.
I managed to do this using the commit api’s build status updates.
POST /projects/:id/statuses/:sha

1 Like

@tomgrin10 did you trigger a pipeline first then update the commit pipeline status with a pipeline_id?

I’ve been looking for this solution for quite a long time. Thank you for sharing your solution.