Concurrency and parallelism

Both concurrency of pipelines and parallel actions let you reduce the waiting time for an execution to finish.

The number of pipelines and actions that can be run simultaneously is specified in the workspace plan.

Concurrency of pipelines

Pipelines concurrency defines how many pipelines can run simultaneously. When more pipelines than your plan allows are running, the subsequent executions will be enqueued, waiting for all previously triggered pipelines to finish.

The number of concurrent pipelines is determined per workspace.

Two pipelines running in concurrency

Parallelism of actions

Thanks to parallelism you can execute multiple actions in one pipeline simultaneously.

For instance: to speed up your tests you can run several tests at the same time. Another common use case of parallel actions is deploying files to a couple of servers at once.

The number of possible parallel actions depends on the chosen plan. If your plan allows 2 concurrent pipelines and 2 parallel actions it means you can run 2 pipelines with 4 actions simultaneously (2 actions in each pipeline).

Below you can see how to configure your pipeline to run tests in parallel.

Run tests in parallel

  1. Create a new pipeline in your project.
  2. Choose ‘Split tests’ action from the actions list. Split tests action
  3. Select the number of groups (packages) into which you want to to split the tests. In this example, we’ll use 3 packages.

Make sure not to exceed the maximum number of parallel actions allowed in your account.

  1. Choose if you want to sort them alphabetically or by file size.
  2. Provide the path to the directory with test files. You can do it in two ways:
    • Select one file with the paths to split (each path in a separate line)
    • Use glob patterns:
      • * – matches any sequence of characters (excluding path separators)
      • ** – matches any sequence of characters (including path separators)
      • ? – matches any single character (excluding path separators)
      • [abc] – matches any character (excluding path separators) against characters in brackets
      • {foo,bar,...} – matches a sequence of characters, if any of the alternatives in braces matches
  3. Once done, save the action: Split tests action configuration
  4. The action creates environmental variables required to run the tests in parallel: $BUDDY_SPLIT_1, $BUDDY_SPLIT_2, $BUDDY_SPLIT_3, and so on. Once the pipeline is executed, you will see them in the logs. Split tests action logs
  5. Next, you need to prepare the environment for the tests (install dependencies etc.) in the selected build action: Build action command console
  6. The last part is adding the actions that will run the tests using the proper variable from the ‘Split tests’ action: Setting proper variables from Split Tests action

You can see we have added 3 testing actions – this is because we chose to split the tests into 3 actions: Split tests pipeline example

See also