GitLab CI/CD: Trigger Pipeline Manually & API

By default, GitLab CI/CD pipelines are executed automatically on pushing new commits to a repository and don’t require any intervention once created.

However, there are also times when you need to trigger pipelines manually, without updating the project.

In this note i will show how to trigger the GitLab CI/CD pipelines manually through the GitLab’s user interface and through the API using cURL, Webhook or from another project’s .gitlab-ci.yml.

Cool Tip: Print all environment variables in GitLab CI/CD! Read more →

Trigger GitLab CI/CD Pipeline

Manually

The GitLab CI/CD pipelines can always be trigger manually with a “Retry” button through the GitLab’s user interface:

Through The API

Alternatively you can trigger the GitLab CI/CD pipelines through the API.

For this go to the GitLab project’s SettingsCI/CDPipeline triggers, add a trigger (this will generate a TOKEN) and use the cURL and Webhook examples to trigger the project’s pipelines through the GitLab’s API:

As shown on the image above, this method can also be used for triggering the pipelines of the one project from another project, by calling the GitLab’s API through a script directive in another project’s .gitlab-ci.yml file.

Was it useful? Share this post with the world!

Leave a Reply