Why all the steps under an "affinity group" waiting?

54 Views Asked by At

Scenario:

We have a pipeline named example_pipeline

example_pipeline has a step named step_1 (not part of any affinity group)

example_pipeline has 2 steps step_2 & step_3 which are under an affinity group named example_affinity_group

step_3 is dependent on step_1 using inputSteps: [] in Pipelines YML

Now step_2 is also waiting for step1 to finish when it has no dependency. What is the reason for this?

Pipelines YML

pipelines:
 - name: example_pipeline
   steps:
     - name: step_1
       type: Bash
       execution:
         onExecute:
           - echo "1"
    
     - name: step_2
       type: Bash
       configuration:
         affinityGroup: example_affinity_group
       execution:
         onExecute:
           - echo "2"

     - name: step_3
       type: Bash
       configuration:
         affinityGroup: example_affinity_group
         inputSteps:
           - name: step_1
           - name: step_2
       execution:
         onExecute:
           - echo "3"

Pipelines Graph View

Pipeline View

1

There are 1 best solutions below

0
On BEST ANSWER

Since the entire affinityGroup runs on a same node and if there are steps in the affinityGroup which are dependent on steps outside of the affinityGroup, the entire affinityGroup has to wait as we cannot queue only steps of the affinityGroup now and some steps later.

This was done so that build nodes should not be sitting idle and waiting for the input steps to finish. Its because to optimise the build node execution.

The steps present in the affinity group waits until the inputStep's affinityGroup execution is complete.