Example
The following simplified pipeline creates two steps bound to the same affinityGroup
called "together":
pipelines: - name: pipeline_affinityGroup_example configuration: environmentVariables: readOnly: MY_DIR: "/tmpdir" steps: - name: ag_step_1 type: Bash configuration: affinityGroup: together execution: onExecute: - mkdir $MY_DIR - echo "Running " $pipeline_name "|" $step_name >$MY_DIR/myoutput.txt - cat $MY_DIR/myoutput.txt - name: ag_step_2 type: Bash configuration: affinityGroup: together inputSteps: - name: ag_step_1 execution: onExecute: - cat $MY_DIR/myoutput.txt
The step ag_step_1
creates a text file in the build node where it executes. The subsequent step, ag_step_2
tries to read the file.
By binding ag_step_1
and ag_step_2
into the same affinity group, the file that is created in the build node's file system by ag_step_1
will be available to ag_step_2
because it is guaranteed to be running in the same node. Without being bound to an affinity group, ag_step_2
may fail because it might execute in a node where the file doesn't exist.
When this pipeline is loaded in the JFrog Platform, the interactive diagram shown in the Pipeline History indicates that these steps are bound into the same affinity group:
When the pipeline is run, the Pipeline Run Logs show that ag_step_2
was able to successfully find the file in the node's filesystem that was created by ag_step_1
.