Use parallel mode to fan-in and fan-out your step dependencies
In pipelines, the concept of fan-in/fan-out is depicted in the diagram below. This pipeline offers parallel sub-flows within the same pipeline. Fan-out refers to spreading a task to multiple destinations in parallel, and fan-in is the opposite, where we spread multiple tasks to the same destination.
As you can see in the diagram, Step1 fans out to Step2 and Step4 (which run in parallel), while Step3 and Step4 fan-in to Step5.
You can achieve parallelism in your Codefresh pipelines by using the following:
You can find the example Spring boot application on GitHub. It is a simple Hello World application with several different types of tests we will use to run using Codefresh’s parallel mode.
Create the pipeline
Our pipeline will have five stages: setup, start, web-tests, smoke, and end:
You should be able to copy and paste this YAML in the in-line editor in the Codefresh UI. It will automatically clone the project for you.
codefresh.yml
NOTE
The special syntax of mode: parallel declared at the root of our yaml makes the pipeline use the full parallel mode.
The order of your build steps doesn’t matter in this case, each step is executed according to its condition.
Step1 (unit tests) fans out to Step2 and Step4 (web tests), which run in parallel
Step3 (smoke tests) does not execute until Step2 is completed
Step3 and Step4 fan in to the final step, Step5 (integration tests)