TeamCity Pipelines Help

Visual Editor

The left pane of the Edit Pipeline screen features a dynamic preview of your current pipeline, showcasing all Jobs in the exact order they will execute. This article explains how to use the panel's built-in visual editor to easily rearrange your Jobs without needing to delve into the Dependencies section of Job settings.

Visual Editor

Specify Dependencies

Quick Actions: Add New Jobs

The quickest way to add a new Job that should precede or follow the required Job is to click the ellipsis ("...") button in the Job's top right corner and choose the required quick action.

Add new linked Job

Note that if you insert a new Job in between currently linked Jobs, the pipeline will split. For example, if you insert a new Job before "Job 2" that already depends on "Job 1", the resulting pipeline will not be a straight "Job 1 → Job 3 (new) → Job 2" sequence. This sequence implies the new "Job 3" also depends on "Job 1" and TeamCity cannot make such assumptions on its own.

Instead, you will end up with two simultaneously starting Jobs that are equally positioned against "Job 2".

Split Pipeline

The Duplicate job action creates a copy of the current Job. The copy has same incoming dependencies as its origin, but ignores outgoing dependencies. For example, if you clone "Job 2" in the "Job 1 → Job 2 → Job 3" setup, your pipeline will look like the following:

Job 1 ---- Job 2 ---- Job 3 | Job 2 Copy

The Delete job menu item is disabled for Jobs on which other Jobs depend. To remove such Jobs you must first remove their outgoing dependencies.

Drag-and-Drop: Link Existing Jobs

If the Jobs you need to unite in a pipeline already exist, you can drag-and-drop them to quickly specify required dependencies.

Hover over a Job side to invoke the "⊕" guides along its borders. Grab a guide and drag it onto a Job that needs to be linked. The resulting order depends on which side the guide belongs to. If you drag the right guide of a Job, you're linking the end of this Job to another Job (thus, choosing a Job that should start after the current one finishes).

Drag Job 1 to Job 2

When you drag the left guide, you're linking the start of this Job to another Job (choosing a Job that should finish before the current Job starts).

Drag Job 2 to Job 1

Dependency Line Menu

Selecting any dependency line invokes the context menu that allows you to remove this relation and specify whether the artifacts produced by the left Job should be passed to the right one. The Use artifacts switch is identical to the corresponding selector in Job Dependencies section.

Dependency context menu

Primary and Secondary Dependencies

The YAML sample below illustrates a pipeline with three consecutively running Jobs:

name: Sample Pipeline jobs: Job1: name: Job A dependencies: [] # ... Job2: name: Job B dependencies: - Job1 # ... Job3: name: Job C dependencies: - Job1 - Job2 # ...

In this setup, "Job C" depends on "Job A" twice: indirectly, through "Job 2" that requires "Job 1" to run, and directly.

TeamCity Pipelines displays this setup as follows:

Primary and secondary dependencies

In order to start, a dependent Job requires all of its parent Jobs to finish, so this sample pipeline runs in the "Job A → Job B → Job C" sequence. This is the primary dependency route highlighted with solid lines. The direct "Job A → Job C" dependency is considered secondary since its presence or absence does not alter the established three-Job order. Such dependencies are painted with dashed lines.

Dashed dependency lines are not displayed on pipeline overview and individual runs' pages since these pages display the actual order of Jobs.

Pipeline with secondary dependencies

However, to give you the full picture of all existing relations between Jobs, these lines are always visible when you edit a pipeline. You can use this to fine-tune artifact import rules. For example, if "Job C" requires an artifact produced by "Job A" but "Job B" does not, you can enable the "Use dependency" toggle only for this dashed dependency line.

Last modified: 18 September 2024