How to extend / adjust
How to extend pipeline definitions
Adjustable pipeline elements
Nodes such as pipelines, steps, or conditions can get extended.
For this purpose, the corresponding blocks can get provided with a reference prefix.
|
Example
<referencePipeline name="my_pipeline" description="new description">
<conditions>
<pipeline_condition type="new_condition_two"/>
</conditions>
<step name="new_step" sortOrder="200">
<conditions>
<step_condition type="pip_one_step_condition_one"/>
<referenceStep_condition type="old_condition" remove="true"/>
</conditions>
</step>
<referenceStep name="existing_step" sortOrder="5"/>
</referencePipeline>
Allowed Reference Nodes
Original Node | Reference Node |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Change/extend pipeline properties
-
With
reference
, pipelines can get edited and extended -
As well as any other information can get edited and overwritten
Example
<referencePipeline name="my_pipeline" description="new description">
<conditions>
<pipeline_condition type="new_condition_two"/>
</conditions>
<step name="new_step" sortOrder="200">
<conditions>
<step_condition type="pip_one_step_condition_one"/>
<referenceStep_condition type="old_condition" remove="true"/>
</conditions>
</step>
<referenceStep name="existing_step" sortOrder="5"/>
</referencePipeline>
Description for referencePipeline
Blocks
Node | Description |
---|---|
referencePipeline |
Definition of an existing pipeline.
|
– name |
Required: string
|
– description |
Optional: string
|
- use-working-directory |
Optional: boolean
The path for this directory is configurable and can be retrieved within an executor by
|
– expire-in |
Optional: string
|
– remove |
Optional: boolean
In case there are further references to a deleted pipeline, they will get logged as well. |
referencePipeline/conditions |
Optional
|
referencePipeline/conditions/pipeline_condition |
Optional
|
referencePipeline/conditions/referencePipeline_condition |
Optional
|
– type |
Required: string
|
– description |
Optional: string
|
– remove |
Optional: boolean
|
referencePipeline/step |
Optional
|
referencePipeline/referenceStep |
Optional
|
Change/extend step properties
-
The Minor Magento version
2.3.0
allows editing and extending steps by reference -
Any information can get edited and overwritten
Example
<referencePipeline name="pipeline_one">
<referenceStep name="change_sort_order_of_step" sort_order="120"/>
</referencePipeline>
Description for referencePipeline
Blocks
Node | Description |
---|---|
referencePipeline/referenceStep |
Definition of an existing step.
|
– name |
Required: string
|
– expireIn |
Optional: string
|
– sortOrder |
Optional: string
|
– description |
Optional: string
|
– executorType |
Required: string
|
– runAlwaysStep |
Optional: boolean
|
– remove |
Optional: boolean
|
referencePipeline/referenceStep/conditions |
Optional
|
referencePipeline/referenceStep/conditions/condition |
Optional
|
referencePipeline/referenceStep/conditions/referenceCondition |
Optional
|
– type |
Required: string
|
– description |
Optional: string
|
– remove |
Optional: boolean
|
referencePipeline/referenceStep/arguments |
Optional
|
referencePipeline/referenceStep/arguments/referenceArgument |
Optional
|
– key |
Required: string
|
– value |
Optional: string
|
– remove |
Optional: boolean
|
Modify existing step conditions
-
An existing pipeline must get referenced
-
Following, you can use a reference to an existing step
-
Then, conditions can get added in the same way as they get added to a newly created step
-
The attribute
remove="true"
, an existing condition, can get deleted
Edit existing pipeline condition
-
An existing pipeline has to get referenced
-
Following, you can use a reference to an existing step
-
After that, conditions can get added in the same way as they get added to a new created pipeline
-
An existing condition can get deleted with the attribute
remove="true"
Add steps to pipeline
-
An existing pipeline must be referenced
-
Following this, a step can get added in the same way as for a new created pipeline
Remove existing pipeline step
To remove an existing step from a pipeline, the reference definition is needed.
How to extend pipeline logic and workflow
Extend init pipeline
In step one, you must implement a custom model for the interface TechDivision\PacemakerPipelineInitializer\Api\InitializationDataFetcherInterface
.
- In Step two, you must register your implementation to the
DataFetcher-Chain
:
<type name="TechDivision\PacemakerPipelineInitializer\Model\InitializationDataFetcherChain">
<arguments>
<argument name="dataFetcher" xsi:type="array">
<item name="pacemaker.order.export" xsi:type="object">TechDivision\PacemakerOrderExport\Model\PipelineInitializer</item>
</argument>
</arguments>
</type>
To execute the dataFetcher
implementation, enable the configuration for using Init-Pipeline to generate a pipeline
Prevention the initialization of pipelines
Initialization prevention of the pipeline in the command line.
- As the following step, register the
excludedPipelines
toTechDivision\ProcessPipelines\Console\InitCommand
to prevent initialization of the pipeline in the config:
<type name="TechDivision\ProcessPipelines\Console\InitCommand">
<arguments>
<argument name="excludedPipelines" xsi:type="array">
<item name="pacemaker_order_export" xsi:type="string">pacemaker_order_export</item>
</argument>
</arguments>
</type>
- Next, register the
excludedFromSource
toTechDivision\ProcessPipelines\Config\Config
:
<type name="TechDivision\ProcessPipelines\Config\Config">
<arguments>
<argument name="excludedFromSource" xsi:type="array">
<item name="pacemaker_order_export" xsi:type="string">pacemaker_order_export</item>
</argument>
</arguments>
</type>
Register virtual pipeline
Besides the pipeline definition via XML, pipelines can also be programmed. These dynamic or virtual pipelines cannot be managed by default.
In order for the pipeline to be manageable via the backend, it must be registered via DI. This requires a PipelineProvider and the registration information.
- Here is standard Pacemaker Order Export for example:
<type name="TechDivision\ProcessPipelines\Model\RegisterVirtualPipelines">
<arguments>
<argument name="virtualPipelines" xsi:type="array">
<item name="pacemaker_order_export" xsi:type="array">
<item name="name" xsi:type="string">pacemaker_order_export</item>
<item name="config_provider" xsi:type="object">TechDivision\PacemakerOrderExport\Model\ExportPipelineConfigurationProvider</item>
</item>
</argument>
</arguments>
</type>
Once this has been done, the pipeline registered in this way is available in the backend for creation, in the cleanup functionality, in the monitoring tool and also via the CLI context.
Exclude pipeline for manual creation
It is possible to exclude pipelines from manual initialisation. To do this, only two di-entries need to be made.
- Exclude pipelines form initialization in Magento backend:
<type name="TechDivision\ProcessPipelines\Config\Config">
<arguments>
<argument name="excludedFromSource" xsi:type="array">
<item name="pacemaker_order_export" xsi:type="string">pacemaker_order_export</item>
</argument>
</arguments>
</type>
- Exclude pipelines form initialization with CLI:
<type name="TechDivision\ProcessPipelines\Console\InitCommand">
<arguments>
<argument name="excludedPipelines" xsi:type="array">
<item name="pacemaker_order_export" xsi:type="string">pacemaker_order_export</item>
</argument>
</arguments>
</type>