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

Webhook External Command #14693

Open
jolheiser opened this issue Feb 15, 2021 · 1 comment · May be fixed by #19307
Open

Webhook External Command #14693

jolheiser opened this issue Feb 15, 2021 · 1 comment · May be fixed by #19307
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@jolheiser
Copy link
Member

jolheiser commented Feb 15, 2021

Related to #1089

Preface, a plugin system would potentially be nicer, but also more complicated. I've opted to open this proposal to see if there is interest.


I'm in the beginning stages of working out how an external command could work.
In my opinion this could cover a vast majority of cases, as the command could also do any data processing and HTTP calls as necessary.

name: custom-py
# Not sure if this should be a local path or URL. If local, Gitea needs a way to serve it e.g. in the custom/img folder
image: /path/to/image.png 
command: [python, /usr/local/bin/custom.py]
form:
  - title: Channel ID
    help: The channel to post to
    required: true

Things inside form would be used by Gitea to present the webhook form. Probably by transforming the title e.g. channel_id from above.

I'm thinking the current gitea JSON payload could be sent to the command via stdin.
I'm not 100% sure how to pass along form inputs, perhaps an enclosing JSON object ?

{
  "form": {...},
  "payload": {...}
}

Then the command can unmarshal the JSON and do whatever it needs to.

@jolheiser jolheiser added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Feb 15, 2021
@zeripath
Copy link
Contributor

This seems like a potential solution - of course windows users will cause no limit of trouble.

If we do this - do not use exec.Command but rather extend the modules/process/manager.go to have a nicer Exec that will take a readers and write to writers. Then the process becomes cancellable from the admin page etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants