A pipeline is organized into stages which are different phases in a software delivery process. The stages include development, QA, user acceptance testing (UAT), preproduction, and production. These stages typically map to the environments where applications or microservices are deployed.
The illustration shows that each stage includes one or more entry gate rules, one or more exit gate rules, and automation tasks that drive the completion of the stage.
A pipeline stage is composed of several key elements that control the following execution flow and automation:
-
Entry gate: Ensures all checks and balances are met before tasks in that stage can begin.
-
Exit gates: Controls when a pipeline can exit a stage and defines what approvals are required.
-
Tasks: Contains the logic that specifies what to do. For example, if your stage is a test stage, it contains the tasks that must be executed to ensure that the test automation for your software delivery process is successfully completed. For more information, refer to [starting-pipeline-run-from-task].
-
Group tasks: Organizes related tasks into a group within a pipeline stage. A group task is not a standalone entity but serves as a container for subtasks that are logically grouped together. For more information, refer to [start-pipeline-run-from-group-task].
-
Parameters: These are created for various objects and automation tasks in the stage, making the pipeline reusable by allowing orchestration of the inputs and outputs for the stage and the properties passed between stages.
You can set run if conditions, wait until conditions, and wait dependencies on pipeline objects. For more information, refer to Pipeline objects and conditions.
Wait conditions can be set for triggered pipelines, triggered releases, and specific pipelines and pipeline objects.
Start a pipeline run from a task
With the required privileges, you can start a pipeline run from a single task, a group task, or a stage.
The task from which you start the pipeline run must have a status of not-run.
When you start a pipeline run from a task, the pipeline has a warning status and message in the stage summary.
Restarting a stage from a task does not always mean the run restarts from the very beginning of the stage. Instead, it typically restarts from the selected task, and the behavior of other tasks depends on their execution state.
You cannot start a pipeline run from a gated task, a subtask that is part of a group, or start from a task with startingStage specified in the run command.
|
To start a pipeline run from a single task:
-
Select the three vertical dots, then select Run from task.
Figure 1. Run a pipeline from a task -
Enter your run details.
-
Select Run.
Start a pipeline run from a group task
A group task is a collection of tasks within a pipeline with taskType=GROUP. With appropriate privileges, you can run a pipeline from a single task, a group task, or an entire stage.
A group task and its subtasks are stored in a single flat list within the stage and the Stage.getTasks() method retrieves all tasks in this list regardless of their nesting structure.
The skipOverwriteTypes method operates on the children.task list, where all the tasks (including those from group tasks) are stored in a single flat list. When using the skipOverwriteTypes method, you must:
-
Specify the group task by name.
-
Explicitly list each subtask that you want to retain.
If the group task is not in the skipOverwriteTypes list, all its subtasks will be cascade-deleted even if the subtasks are explicitly listed in the retention list. Subtasks cannot exist without the parent group task.
|
To retain a subtask within a group task, ensure the task name is in the children.task list using the following command:
ectool evalDsl --overwrite 1 --dslFile stage.dsl --projectName Demo --pipelineName Test_demo_pipeline --skipOverwriteTypes '{"parentTypes":["Group_Task_1"],"children":{"task":["Task_1","Task_2","Task_3","gate":["POST"]}}'
For example, if a group task contains three subtasks and you want to retain only one, list only that subtask (along with the parent group task). The remaining subtasks are removed during overwrite reconciliation.
To start a pipeline run from a group task:
-
Select the three vertical dots, then select Run from group.
-
Enter your run details.
-
Select Run.
| You cannot start a pipeline run from a subtask within a group task. |
Start a pipeline run from a stage
To start a pipeline run from a stage:
-
Select the three vertical dots, then select Run from stage.
-
Enter your run details.
DSL example
Click to view DSL example
// data variables def projName = 'Test Start pipeline at a task' def pipelineName = 'test pipeline' def stageNames = [s1: 'stage_1', s2: 'stage_2', s3: 'stage_3'] def taskNames = [t1 : 'task_1', t2 : 'task_2', t3 : 'task_3', subTask1: 'sub_task_1', subTask2: 'sub_task_2', group : 'group_task', gt1 : 'gate_task_1', gt2 : 'gate_task_2'] def gateConditionValue = '''/* Sample code to set the evidence on the task and pass the condition */ $[/javascript setProperty("/myTaskRuntime/evidence", "test value") true; ]''' // pipeline structure project projName, { pipeline pipelineName, { stage stageNames.s1, { gate 'PRE', { task taskNames.gt1, { gateType = 'PRE' gateCondition = gateConditionValue taskType = 'CONDITIONAL' } } gate 'POST', { task taskNames.gt2, { gateType = 'POST' gateCondition = gateConditionValue taskType = 'CONDITIONAL' } } task taskNames.t1, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.t2, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.group, { subproject = 'Default' taskType = 'GROUP' task taskNames.subTask1, { groupName = taskNames.group actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.subTask2, { groupName = taskNames.group actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } } task taskNames.t3, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } } stage stageNames.s2, { gate 'PRE', { task taskNames.gt1, { gateCondition = gateConditionValue gateType = 'PRE' taskType = 'CONDITIONAL' } } gate 'POST', { task taskNames.gt2, { gateType = 'POST' gateCondition = gateConditionValue taskType = 'CONDITIONAL' } } task taskNames.t1, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.t2, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.group, { subproject = 'Default' taskType = 'GROUP' task taskNames.subTask1, { groupName = taskNames.group actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.subTask2, { groupName = taskNames.group actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } } task taskNames.t3, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } } stage stageNames.s3, { gate 'PRE', { task taskNames.gt1, { gateCondition = gateConditionValue gateType = 'PRE' taskType = 'CONDITIONAL' } } gate 'POST', { task taskNames.gt2, { gateCondition = gateConditionValue gateType = 'POST' taskType = 'CONDITIONAL' } } task taskNames.t1, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.t2, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.group, { subproject = 'Default' taskType = 'GROUP' task taskNames.subTask1, { groupName = taskNames.group actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } task taskNames.subTask2, { groupName = taskNames.group actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } } task taskNames.t3, { actualParameter = [ 'commandToRun': 'echo success', ] subpluginKey = 'EC-Core' subprocedure = 'RunCommand' taskType = 'COMMAND' } } } } // start pipeline at a task runPipeline projectName: projName, pipelineName: pipelineName, startingTaskStage: stageNames.s2, startingTask: taskNames.t2 -
Select Run.
Figure 2. Run result