Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Triggers overview

1 week ago5 min read
Cloud
Server v4+
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

  1. In the CircleCI web app, select your organization from your homepage, then select your project, either from your org homepage or select Projects from the sidebar for a full list. You will now be on your project’s pipelines page.

  2. Select Trigger Pipeline.

    Screenshot showing location on trigger pipeline button in the CircleCI web app
  3. Select the pipeline you want to trigger from the dropdown menu.

  4. Select your config source branch. This tells CircleCI where (repo and branch) to find your pipeline config.

    Trigger a pipeline modal in the CircleCI web app
  5. If your code is integrated via the GitHub App or Bitbucket Data Center, select your checkout source and branch. This tells CircleCI which code to check out when running a checkout step.

  6. If you would like to specify any pipeline parameters, select Add + and enter the required fields.

  7. Select Run Pipeline and you will see your new pipeline running in the web app.

Trigger a pipeline using the API

Trigger a pipeline from a custom webhook

Follow these steps to set up and test a custom 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 (), select Project Settings, and select Pipelines in the sidebar.

  3. If there is already a GitHub App pipeline set up and it uses the desired YAML configuration file, proceed to the Triggers step below (step 5). If not, select Set up pipeline. If there is a Connect button, select it and follow the steps to install the CircleCI GitHub App into your GitHub organization (this step is compatible with orgs that integrate with CircleCI’s GitHub OAuth app).

  4. Name the new pipeline and select the repository where the CircleCI YAML configuration file is stored. Enter the file path (including the .circleci directory). The file path can be different than .circleci/config.yml (for example, .circleci/webhook.yml). Save the pipeline.

  5. Select Triggers in the sidebar.

  6. Select Add Trigger.

  7. Select Custom Webhook from the dropdown menu.

  8. Select Next.

    screenshot showing adding a custom webhook trigger
  9. Complete the form fields and options:

    • Enter a descriptive name for the trigger. For example, if you are setting up a custom webhook to run pipelines on events from Datadog, enter "Datadog" here.

    • (Optional) Add a description.

    • In the field "Pipeline to run", at the bottom of the page, select the pipeline that you created in the step above.

    • Enter the branch to use to fetch your config file when a Custom Webhook is received.

    • Enter the branch to use to check out your code when using the checkout step in config. If your config is stored in the same repository as your code, then your Config branch and your Checkout branch should be the same.

  10. Select Save.

  11. 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 a custom webhook trigger secret and URL
  12. You can now test your custom 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" 'https://internal.circleci.com/private/soc/e/<your-URL>?secret=<your-secret>'

For more information on using custom 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/Bitbucket Data Center 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