Skip to content
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

fix(workflow-hook): pre/post hook not sending output due to invalid key #3091

Merged
merged 1 commit into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/core/runtime/post_workflow_hook_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func (wh DefaultPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContex
}
}

wh.OutputHandler.SendWorkflowHook(ctx, fmt.Sprintf("%s\n", string(out)), true)
wh.OutputHandler.SendWorkflowHook(ctx, string(out), false)
Copy link
Member

@nitrocode nitrocode Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and fix @Fabianoshz. Could you please add the test section to the pr body to describe how this was tested e2e for post and pre workflpws?

Oh and could you verify that this works with automerge and no automerge?

And if possible, could you also add a unit test for this to ensure this doesn't break pre and post workflow runs going forward?

Copy link
Member

@nitrocode nitrocode Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @Fabianoshz friendly ping

also have you tested this change out in your own setup?

wh.OutputHandler.SendWorkflowHook(ctx, "\n", true)

ctx.Log.Info("successfully ran %q in %q", command, path)
return string(out), strings.Trim(string(customStatusOut), "\n"), nil
Expand Down
3 changes: 2 additions & 1 deletion server/core/runtime/pre_workflow_hook_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func (wh DefaultPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext
}
}

wh.OutputHandler.SendWorkflowHook(ctx, fmt.Sprintf("%s\n", string(out)), true)
wh.OutputHandler.SendWorkflowHook(ctx, string(out), false)
wh.OutputHandler.SendWorkflowHook(ctx, "\n", true)

ctx.Log.Info("successfully ran %q in %q", command, path)
return string(out), strings.Trim(string(customStatusOut), "\n"), nil
Expand Down