Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Pipelines overview

5 days ago13 min read
Cloud
Server v4+
On This Page

CircleCI pipelines are the highest-level unit of work in your CI/CD process. Defined by a configuration file (typically .circleci/config.yml), pipelines orchestrate the execution of workflows which run jobs to build, test, and deploy your code.

Pipelines can be triggered in the following ways:

  • Automatically: Git events, scheduled events, custom webhooks

  • Manually: CircleCI app or API

Pipelines provide a flexible framework for creating conditional workflows based on filters, job requirements, and pipeline parameters, allowing you to customize your CI/CD process to fit your project’s needs.

Pipelines dashboard

Your pipelines dashboard displays recently-triggered pipelines for your organization. Use the various filters to find the pipelines you need. Click through to view workflow maps and individual job steps. Use the quick controls on the right of the screen to rerun and cancel workflows.

Screenshot of the pipelines dashboard in the CircleCI app

From the pipelines dashboard you can find the pipeline ID. The pipeline ID is a unique ID for a pipeline that has been triggered. You can use the pipeline ID to access pipeline information via the API.

Screenshot showing the location on the pipeline ID

Pipelines and triggers

Set up pipelines to define the various CI/CD "units" that make up your project.

Set up triggers to define when and how each of your pipelines should be run. Triggers may be from external services (custom webhooks), from commits or tags on a version control system, or set up to run on a schedule.

Pipelines

A pipeline defines a unit of work that can be run within your projects. Each pipeline is defined by two key characteristics:

  • A config source, which is a configuration file stored in a repository. The default config source location is .circleci/config.yml within the same repositry as your code.

  • A checkout source, which determines which repository will be checked out when running a checkout step.

A project can have one or more pipelines, and each pipeline can be associated with zero or more triggers.

When you create a project in CircleCI and follow the in-app project creation flow to connect it to a repository, a first pipeline is set up for you automatically. The config file used for your first pipeline is either a file you commit yourself or one generated by CircleCI based on the code in your project. You can identify the type (GitHub App, GitHub OAuth) of a pipeline using the badges in the Config Source column on the Project Settings  Pipelines page.

Each pipeline has a Definition ID. This is a UUID for the pipeline, which can be used to refer to a specific pipeline when triggering it via the API.

Pipelines page in project settings

Add or edit a pipeline

The steps and options described in this section are for setting up a GitHub App pipeline. If you are setting up a pipeline for a different version control system the options you see may vary but the process is mostly the same.

Add a pipeline

To add or edit a pipeline, follow these steps:

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

  2. Select the ellipsis next to your project () and choose Project Settings.

  3. Select Pipelines in the sidebar.

  4. Select Add Pipeline, or, if you wish to edit an existing pipeline select the pencil icon on the right.

  5. Complete the form fields and options:

    • Give your pipeline a descriptive name, for example Run tests and deploy.

    • Under Integration select the platform that matches where your project is set up (for example, GitHub App).

    • Authorize your connection if this is not already showing with a check mark ().

    • Define where the config file for this pipeline is stored:

      • Select a repository from the dropdown.

      • Enter the path to the config file.

    • Under Build Assets, select a Checkout Source for this pipeline. This is the repository that will be checked out when a checkout step is run. If your config is stored in the same repository as your code, pick the same repository you selected for the Config Source.

  6. Select Save.

Once you have set up a pipeline you need to set up a trigger to connect it to. This is described in the following section.

Triggers

Triggers are configurable rules that determine when to automatically run a pipeline based on specific events and conditions. A project can have one or more triggers, which are associated with events from a source of change. The most common type of trigger is a VCS event, for example a push to a branch on a GitHub repository, but any system that can emit outbound webhooks can also be set up as a trigger. A trigger can have only one pipeline but a pipeline can have multiple triggers.

A trigger kicks off a pipeline to run the workflows defined in your connected config source.

Add a trigger

To add a trigger for a pipeline, follow these steps:

Pipeline parameters

Pipeline parameters are declared using the parameters key at the top level of a .circleci/config.yml file. Pipeline parameters can be referenced by value and used as a configuration variable under the scope pipeline.parameters.

The example below shows a configuration with two pipeline parameters (image-tag and workingdir) defined at the top of the configuration, and then subsequently referenced in the build job:

version: 2.1

parameters:
  image-tag:
    type: string
    default: "current"
  workingdir:
    type: string
    default: "~/main"

jobs:
  build:
    docker:
      - image: cimg/node:<< pipeline.parameters.image-tag >>
    environment:
      IMAGETAG: << pipeline.parameters.image-tag >>
    working_directory: << pipeline.parameters.workingdir >>
    steps:
      - run: echo "Image tag used was ${IMAGETAG}"
      - run: echo "$(pwd) == << pipeline.parameters.workingdir >>"

A pipeline can be triggered with specific parameter values using the API v2 or via the CircleCI web app.

See the Pipeline values and parameters page for more information.

VS Code extension

If you use Visual Studio Code, you can also monitor and interact with your pipelines directly from VS Code with the official CircleCI extension. The extension allows you to customize which projects and pipelines you want to follow, as well as view job logs and test results, download artifacts, approve, re-run, and debug jobs with SSH, and get notified when your workflows fail or need approval.

Screenshot showing the detailed view of a failed test

The CircleCI VS Code extension is available to download on the VS Code marketplace.

Troubleshooting

Config could not be located error

If you see the following error message, check the steps below to remediate the issue.

config file .circleci/sample-filename.yml could not be located on branch sample-branch-name in repository sample-repo-name
  • Ensure that there is a CircleCI configuration file in the repository on the branch that uses the filename specified in the error message. If there is not one present, add a CircleCI configuration file.

  • If there is a config file present:

    1. Navigate to Project Settings  Pipelines in the CircleCI web app for the project where you are seeing this error message.

    2. Select the pencil icon for each pipeline listed and ensure that the "Config File Path" field matches the filepath of the config file that is in your repository. If you changed the name of the config file in your repository, the reference to that filepath must also be changed in the Project Settings  Pipelines section for any pipeline that uses that configuration file.

Why is my scheduled pipeline not running?

If your scheduled pipeline is not running, verify the following things:

  • Is the actor who is set for the scheduled pipelines still part of the organization? You can find this setting is under Attribution in the Triggers section of the web app.

  • Is the branch set for the schedule deleted?

  • Is your VCS organization using SAML protection? SAML tokens expire often, which can cause requests to fail.

Why are my jobs not running when I push commits?

In the CircleCI application, check the individual job and workflow views for error messages. More often than not, the error is because of formatting errors in your .circleci/config.yml file.

See the YAML Introduction page for more details.

After checking your .circleci/config.yml for formatting errors, search for your issue in the CircleCI support center.

Why is my job queued?

A job might end up being queued because of a concurrency limit being imposed due your organization’s plan. If your jobs are queuing often, you can consider upgrading your plan.

Why are my jobs queuing even though I am on the Performance Plan?

In order to keep the system stable for all CircleCI customers, we implement different soft concurrency limits on each of the Resource classes. If you are experiencing queuing on your jobs, it is possible you are hitting these limits. Contact CircleCI support to request raises on these limits.

Why can I not find my project on the Projects dashboard?

If you are not seeing a project you would like to build, and it is not currently building on CircleCI, check your org in the top left corner of the CircleCI application. For instance, if the top left shows your user my-user, only projects belonging to my-user will be available under Projects. If you want to build the project your-org/project, you must switch your organization on the application’s organization switcher menu to your-org.

How do Docker image names work? Where do they come from?

CircleCI currently supports pulling (and pushing with Docker Engine) Docker images from Docker Hub. For official images, you can pull by simply specifying the name of the image and a tag:

golang:1.7.1-jessie
redis:3.0.7-jessie

For public images on Docker Hub, you can pull the image by prefixing the account or team username:

my-user/couchdb:1.6.1

What is the best practice for specifying image versions?

It is best practice not to use the latest tag for specifying image versions. It is also best practice to use a specific version and tag, for example cimg/ruby:3.0.4-browsers, to pin down the image and prevent upstream changes to your containers when the underlying base distribution changes. For example, specifying only cimg/ruby:3.0.4 could result in unexpected changes from browsers to node. For more context, refer to Docker image best practices, and CircleCI image best practices.

How can I set the timezone in Docker images?

You can set the timezone in Docker images with the TZ environment variable. A sample .circleci/config.yml with a defined TZ variable would look like the following:

version: 2.1
jobs:
  build:
    docker:
      - image: your/primary-image:version-tag
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD  # context / project UI env-var reference
      - image: mysql:5.7
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD  # context / project UI env-var reference
        environment:
           TZ: "America/Los_Angeles"
    working_directory: ~/your-dir
    environment:
      TZ: "America/Los_Angeles"

In this example, the timezone is set for both the primary image and an additional mySQL image.

A full list of available timezone options is available on Wikipedia.

Next steps

Find out more about triggering pipelines in the Triggers Overview.


Suggest an edit to this page

Make a contribution
Learn how to contribute