Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Parallel tasks in CodeStream pipeline

glechev edited this page Jun 30, 2021 · 1 revision

Parallel tasks in CodeStream pipeline

Usually we want some of the tasks in our pipeline to be parallel. This is often the case when you want to perform to operations/tasks simultaneously.This is achieved by using ParallelTask and providing the tasks you want to be parallel as input.

return Pipeline.builder()
                .name("my-pipeline-name")
                .stages([
                        Stage.builder()
                                .name("Build")
                                .tasks([
                                        PipelineTask.builder()
                                        .name("task-0")
                                        .build(),
                                        new ParallelTask([
                                                PipelineTask.builder()
                                                        .name("task-1")
                                                        .build(),
                                                RestTask.builder()
                                                        .name("task-2")
                                                        .agent("agent")
                                                        .url("https://vmware.com")
                                                        .payload("hello")
                                                        .build(),
                                                
                                        ])
                                ])
                                .build(),
                ])
                .build()

In the above example task 1 and task 2 will be executed in parallel after successfult execution of task 0.