Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Pipelines overview

1 week ago10 min read
Cloud
Server v4.x
Server v3.x
On This Page

CircleCI pipelines are the highest-level unit of work, and they are described by a configuration file, for example, .circleci/config.yml. Triggers can be set up to automate when a pipeline will be triggered. Pipelines coordinate the execution of workflows and jobs to build, test, and deploy your code. Workflows can be conditional, based on filters, job requirements, and pipeline parameters.

Pipelines include your workflows, which coordinate your jobs. Pipelines have a fixed, linear lifecycle, and are associated with a specific actor. Pipelines trigger when a change is pushed to a project that has a CircleCI configuration file included, and can also be scheduled, triggered manually through the CircleCI app, or using the API.

Dashboard

When visiting your CircleCI dashboard, you are shown a list of recently-triggered pipelines for your organization.

Screenshot of the pipelines dashboard in the CircleCI app

Pipeline architecture

A pipeline is composed of workflows, which are composed of jobs. By navigating from a pipeline to a specific job, you can access your job output, test results, and artifacts through several tabs.

Job tab options in the CircleCI web app

The output of each job can be opened in a new tab (in either raw or formatted styling) with a unique link, making it shareable between team members.

Download and share job step output

Pipelines and triggers

Set up pipelines and triggers to define when and how pipelines are automatically triggered for a project. These triggers may be from external services (custom webhooks), or from commits or tags on a version control system.

Pipelines

Pipelines define units of work that can be run within your projects. Each pipeline is defined by two key characteristics:

  • A configuration file, which is stored in a repository referred to as config source, at a path of your choosing. The default config source location is .circleci/config.yml, but any file path with extension *.yml can be used.

  • A checkout source, which determines which repository will be checked out when running a checkout step. This model allows your CircleCI config to be stored in a different repository from your code.

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

When you create a project in CircleCI and connect it to a repository, a first pipeline is set up for you automatically. The connected configuration file is either a file you commit yourself or one generated by CircleCI based on the code in your project.

Pipelines page in project settings

Add or edit a pipeline

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). If you integrate with CircleCI’s GitHub OAuth App) you can select GitHub App here to install the App into your org and access improved security and new features.

    • Authorize your connection if this is not already showing with a

    • 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 field 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 rules to define that a pipeline should be run on a given event. 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:

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