I have a step that executes a custom .NET tool to migrate a legacy database. It's designed to take a parameter representing the database to migrate so that you can call it like so:
dotnet run -- SC
dotnet run -- AL
dotnet run -- GA
Each run will migrate the specified database. I can set up a step to execute these three lines one after another in a single script within a single step but I'd like to be able to run them in parallel. So I have a boilerplate anchored step with all the pre-amble script that eventually culminates in
dotnet run -- ${STATE}
But now I'm having trouble figuring out how to arrange the parallel steps to pass in the contents of the ${STATE} variable to each instance of the step.
I've searched the forum and elsewhere and discovered it's not easy to do this. I found an open issue (that I've since lost) to allow sharing variables across steps. I also found one trick to save the variable you want as an artifact to be picked up by the later step but I'm not sure that will work because as far as I know, I'll just end up overwriting the same artifact used by the shared step for each iteration. So I'm wondering what's a good workaround that will let me execute many instances of this shared step, each with a different value for this one ${STATE} variable.
Hey @kbaley
You can try and wrap the step's script in a file and then pass the state as an argument to the script. Something like this:
- step:
script:
- ./my_script "SC"
- step:
script:
- ./my_script "AL"
Hope that helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.