Start Building for Free

Triggers overview

4 weeks ago3 min read
Server v4.x
Server v3.x
On This Page

Pipelines are triggered in response to actions or scheduled to run at specific times and frequencies. Each method of triggering a pipeline is described below.

Trigger a pipeline on push to your code repository

Once a project is hooked up to CircleCI, a pipeline is triggered each time a commit is pushed on a branch that has a .circleci/config.yml file included. Once the commit is pushed the running pipeline appears on the pipelines dashboard, which is accessible by selecting Dashboard from the left hand sidebar in the CircleCI web app.

Screenshot showing running pipelines in the CircleCI dashboard.
Figure 1. Pipeline running and visible on the dashboard

Trigger a pipeline from the CircleCI web app

In the CircleCI web app, when you have a specific branch selected, the Trigger Pipeline button becomes enabled:

  1. Select your branch using the branch filter at the top of the dashboard.

    screenshot showing location of branch filter on pipelines dashboard
  2. Select Trigger Pipeline. At this point you can choose whether you want to specify any pipeline parameters.

    screenshot showing the popup you will see when slicking the trigger pipeline button in the web app
  3. Select Trigger Pipeline again (or Cancel) and you will see your new pipeline start.

Trigger a pipeline using the API

  1. If you have not already, get set up to use API v2 by following the steps in the API Developers Guide.

  2. To trigger a pipeline from the command line using curl, copy and paste this sample request and replace the details in < > with your details, VCS can be gh or bb:

    curl -X POST<VCS>/<your-vcs-org-or-username>/<your-repo-name>/pipeline \
      --header "Circle-Token: $CIRCLE_TOKEN" \
      --header "content-type: application/json" \
      --data '{"branch":"<your-branch-name>"}'
  3. Head back to the CircleCI web app and see your pipeline running on the dashboard.

Trigger a pipeline from an inbound webhook

Follow these steps to set up and test an inbound webhook trigger for a pipeline from anywhere that can emit a webhook or run a curl command:

  1. In the CircleCI web app select Projects in the sidebar.

  2. Find your project in the list, select the ellipsis (), and select Project Settings.

  3. Select Triggers in the sidebar.

  4. Select Add Trigger.

  5. Select Inbound Webhook from the dropdown menu.

  6. Select Next.

    screenshot showing adding an inbound webhook trigger
  7. Complete the form fields and options:

    • Give your trigger a descriptive name.

    • (Optional) Add a description.

    • Supply a path to a config.yml file and CircleCI will create a configuration source for you:

  8. Select Save.

  9. You will see a webhook endpoint URL and secret. You can use these to set up your webhook trigger from your external source. Copy the Webhook URL and use it in your trigger source appended with the secret.

    screenshot showing inbound webhook trigger secret and URL
  10. You can now test your inbound webhook trigger with curl. To trigger your pipeline, copy and paste the following sample request and replace <your-URL> and <your-secret> with the URL and secret that you generated in the previous step:

    curl -X POST -H "content-type: application/json" '<your-URL>?secret=<your-secret>'

For more information on using inbound and outbound webhooks, see the Use webhooks to integrate with services page. Also, see our community forum for more details or how to use this functionality with a 3rd party service like DockerHub.

Trigger a pipeline from VS Code with unversioned config

Trigger pipelines from VS Code to iterate on your CircleCI config without committing your trial and error changes to your version control system. Run and validate your full pipeline, or select jobs and workflows to validate individually. View the results of your test runs in the extension pipelines panel or in the CircleCI web app, just the same as any other pipeline.

For full details, see the VS Code extension overview.

Screenshot showing the run panel

Schedule a pipeline

For non GitLab/GitHub App projects, scheduled pipelines allow you to trigger pipelines periodically based on a schedule. To get this set up for a project you can either use the CircleCI web app or use the API v2. For full details of both methods see the Scheduled Pipelines docs.

Next steps

Read about orchestrating elements of work within pipelines on the Using Workflows to Orchestrate Jobs page.

Suggest an edit to this page

Make a contribution
Learn how to contribute