Add output schemas for runners that just have a generic response #6102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
add a generic output schema to the local, remote, and winrm runners. St2 already appears to return the data in this format, this is simply formalizing the response so that validations can be added for commands leveraging these runners to better allow users of st2 to verify the integrity of the data their pipelines are processing
I'm curious about any issues people are aware of this would cause. Initially the thought was this would cause regressions in existing jobs, but the results are identical between the new and old changes, so those existing jobs would be unaffected. As I'm new to the st2 code base and the community in general I'm curious if there are any other potential issues that would prevent this change from moving forwards.
Also if anyone knows where the appropriate location to add tests for these cases is, please lmk. I did an initial dig through the code but didn't find where the serialization was happening... I'm beginning to think it's happening in the DB itself, but can't confirm that's the case.
I've provided 4 examples below with the core.local, which uses the local-shell-cmd runner. The first two examples are what currently happens, and the second two examples are with the change. You'll notice they're equivalent, but with the change it allows for validations to be executed.
without changes
core.local ->
echo "hello world"
result:
core.local ->
curl <http endpoint that returns json>
the simple http endpoint in this example returns the following object:
result in st2:
with the output_schema changes
core.local ->
echo "hello world"
core.local ->
curl <same http endpoint as before>
result:
Json object inside of full result
core.local ->
echo "hello world" && curl <same http endpoint as before>
This will not parse to json, so the resulting stdout will just be a string.