I have a generic pipeline where I want the cluster sizes to be configurable. The idea is to use an optional parameter where I can set a default pipeline in the generic pipeline, so I don't have to change many other pipelines that reference this generic pipeline. The parameter definition is shown here below.
We now want to use this Object parameter in order to select the cluster size corresponding to our current environment. This is done as follows:
This goes well if I pass an explicit value for the Parameter from the outer (calling) pipeline, like so: .
I also want other (unchanged) pipelines that call the generic pipeline to continue running with a default value. Those are called as follows:
but that results in the following error:
Please note: it is not possible to use Dynamic Content to set the default value for a Pipeline Parameter of type Object. Which adaptations should I make in order to correctly set the default value for clusterSizes as a json object?
I tried the above scenario with the below JSON as object type parameter in a child pipeline.
{"name":["Rakesh"],"Age":[22],"nickname":["Laddu"],"luck":[]}
I have used @pipeline().parameters.param1[variables('one')]
expression in the child pipeline and called it from Parent pipeline.
And I got the same error.
This is because, when we are not passing any values for the child pipeline parameters from parent pipelines and expecting to take default parameter values for it, it is taking the type of that value as a String.
Input for the Execute pipeline activity.
You can see it took the value as string even though we defined it as an object type.
When I tried with other data types, it took correct types for int
and bool
types.
But, for the Object
, array
and float
types it took type as string only. This might be a bug in ADF.
As you want the other pipelines to continue with default values, changing the generic pipeline might be the workaround in this case.
Which adaptations should I make in order to correctly set the default value for clusterSizes as a json object?
In your generic pipeline, when using that parameter convert that to object with the below expression.
@json(string(pipeline().parameters.param1))[variables('one')]
With this expression, the pipelines which requires default values will be converted to JSON object and the pipelines which uses the dynamic content parameter values will be converted to string and again converted to JSON object.