As per the use case we can have a pipeline running single WF but multiple services throughout the pipeline.
Now according to the problem statement you want to skip the deployment of various services within the pipeline. We also understand that you are running every stage in parallel.
We in Harness have provision to skip the execution of specific Pipeline Stages based on Assertion Expression conditions as mentioned in Pipeline Skip Conditions - Harness.io Docs.
Configuring this would have been easier if you had multiple workflows running through the pipeline. As every workflow would have different WF variables which could be easily resolved via context variables through the pipeline. But according to your use case as you have configured a single workflow but a different service through the pipeline. It’s difficult to resolve WF Variables through each step.
Hence need to create variables as many numbers stages in the pipeline to skip the desired step.
This is a small demonstration to show how can achieve this use case:
- We created a pipeline consisting of 4 different services running a single workflow.
- We created 4 Workflow variables Skip1…,2,3 &4 to associate them to each stage in the pipeline.
- We configured Skip based conditions and set up similar assertion Expressions for every step. Now during the deployment it would skip based on the skip condition ==“Yes” is meant to skip the stage in the pipeline. ( Note: It is required the values are not selected for these skip variables as given in the screenshot for each stage ) as this allows us to select them dynamically during pipeline deployment.
Note: It is required for the values of the workflow to not be selected in the individual stages, instead, you would need to leave the fields empty with no values. You can do this by clicking on the small x mark on each field for the steps to make sure no value is selected, as this allows us to select them dynamically during pipeline deployment.
The outcome for all the stages would look like something below where the fields for the variables are empty :
This in turn will ensure that since the values have not been selected on each stage, they will be required to be selected at runtime when you click the Deploy button for selection.
- When we run the deployment it would ask us for the values for skip variables where “Yes” would skip the stage and execute next.
- Based on the given inputs in the screenshot the execution would skip Stage1 and Stage 4.