-
-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add output schemas for runners that just have a generic response #6102
Open
rebrowning
wants to merge
8
commits into
StackStorm:master
Choose a base branch
from
rebrowning:add_output_schemas_for_shell_runners
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add output schemas for runners that just have a generic response #6102
rebrowning
wants to merge
8
commits into
StackStorm:master
from
rebrowning:add_output_schemas_for_shell_runners
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pull-request-size
bot
added
the
size/L
PR that changes 100-499 lines. Requires some effort to review.
label
Dec 22, 2023
…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
…hat st2 is currently outputting, so they were failing with the new schema being applied
…t's easier to find the issues... That flag can be removed if necessary
rebrowning
force-pushed
the
add_output_schemas_for_shell_runners
branch
from
January 12, 2024 18:39
036f1cd
to
1bcd9e4
Compare
cognifloyd
reviewed
Feb 19, 2024
Comment on lines
+44
to
+49
stdout: | ||
anyOf: | ||
- type: "object" | ||
- type: "string" | ||
- type: "array" | ||
- type: "number" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be any of the simple json types? Why these 4?
https://github.com/StackStorm/st2/blob/master/st2common/st2common/util/schema/action_params.json#L19
I guess we need to look at how stdout is converted from json to see if there are any restrictions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.