Problem Statement
We are trying to generate a list of strings and using that output from a step to next step looping strategy, but it is throwing an error.
"Invalid request: Could not parse the repeat strategy. Please ensure you are using list of strings"
Solution
The issue is occurring because the Output Variable of the shell script is a string, which you are trying to pass as a list of strings, to avoid this :
-
First you need to convert your array/list into a string and then pass it as an output variable (note that Output variable can be of only two type either a String or a Secret).
-
Then convert this string into a list of string again before passing it to the repeat strategy.
Here are the steps to follow :
- We have a list which of items, that we would like to iterate, we will convert this into a string to pass it as an output variable :
items=("18", "17", "16", "15", "14", "13", "12", "11", "10", "9")
new_var_pubic_ids=$(printf "%s," "${items[@]}" | sed 's/,$//')
- Create a custom variable which would carry the value of the Output Variable as an expression and we will split it into a list of string within the same expression
(<+execution.steps.ShellScript_1.output.outputVariables.new_var_pubic_ids>).split(",")
- Now use this custom variable in your repeat strategy
That’s all for this article Happy Building Deploying and Much more with Harness