Comments (7)
I think you log stderr and only return stdout.
from webhook.
Thanks @adnanh, this change makes a real difference! I tested it just now and would like to ask you two things:
- What do you think of including the output of failed commands just as it's done for the succeeded ones? I added
exit 42
to myrun.sh
and started getting500
as expected. At the same time, I stopped seeing all the nice output I expected before the last (malformed) command. Webhooks are often used in CI scripts and it's useful to see why a particular build has failed without going to the production server and scrolling through the logs. - I've noticed that
response-message
is not showing wheninclude-command-output-in-response
is set to true. The build script I have is checking the result of the webhook against the presence of a response message and considers itself successful only if it is found. I know that I can use HTTP 200/500 for the same check now wheninclude-command-output-in-response
is on, but the current behaviour is still not intuitively obvious. An extra check can be useful e.g. to protect yourself from the webhook endpoint being replaced with smth else that always returns 200. How about appendingresponse-message
on success in all cases and thus remove a not-very-intuitive side-effect ofinclude-command-output-in-response
?
Thanks again for your work on this project! It's one of those nice little things that make people's lives better :-)
from webhook.
Hello :-)
Regarding the point number 1:
I propose adding a flag to include stdout & stderror in failed executions and leave the current behavior as default.
Regarding the point number 2:
You could wrap your command in a script that echoes your string to stdout and then runs the original command, and you have restored the old functionality. :-)
Having said that, I personally believe that the described use-case should be modified to use headers as a transport of such details.
You can define custom response headers on hook execution using response-headers
setting in hooks.json, or on all hooks by using -header
flag when starting webhook (you can find more details about those fields & flags on the wiki pages). i.e. you could set 'X-Served-By' header to return 'webhook' and check for it's existence in your build script, rather than mixing custom response message & the command output.
Cheers!
from webhook.
I have a potential fix in my repo, but I can't create a PR against the development branch because dev is behind master (merge conflicts). @adnanh, once you get the dev branch in sync, I can create a PR.
from webhook.
What to do with stderr? Should it be merged with stdout, or just print out the stdout without stderr?
from webhook.
This will be added in 2.5.0.
include-command-output-in-response
flag will now make webhook return raw stdout and log stderr.
from webhook.
Hey @adnanh,
I would like to make sure: you proposal from point 1 was not implemented, right? As of now if you return exit code != 0 and use include-command-output-in-response
then you lose the output?
from webhook.
Related Issues (20)
- Vulnerability of dependency "golang.org/x/sys" HOT 1
- Missing payload?
- Webhook does not execute command but always reports 'ok' HOT 2
- If my boolean value is not quoted, will it be matched HOT 1
- Webhook doesn't get triggered when behind a traefik reverse proxy HOT 3
- Broadcasting Slack Slash Command's Response HOT 1
- Header evaluation is broken HOT 4
- Step-by-step tutorial for a 'Hello world'
- Vulnerabilities of dependency "gopkg.in/yaml.v2"
- webhook hook not running bash script HOT 6
- Bitbucket now supports webhook secrets 🥳 HOT 1
- I found that I can't use dot-notation to contain all sub-objects in my json
- I need to parse url for addr:port HOT 1
- Update `go` installation
- Ubuntu Webhooks is not reading the correct RVM ruby installed HOT 2
- Custom logging
- Webhook id is not being served in URL HOT 2
- how to set shell $PATH HOT 4
- Weird Cert issue when calling webhook from shell HOT 1
- pass-file-to-command as optional HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webhook.