Giter Club home page Giter Club logo

Comments (7)

moorereason avatar moorereason commented on May 3, 2024 1

I think you log stderr and only return stdout.

from webhook.

kachkaev avatar kachkaev commented on May 3, 2024 1

Thanks @adnanh, this change makes a real difference! I tested it just now and would like to ask you two things:

  1. 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 my run.sh and started getting 500 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.
  2. I've noticed that response-message is not showing when include-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 when include-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 appending response-message on success in all cases and thus remove a not-very-intuitive side-effect of include-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.

adnanh avatar adnanh commented on May 3, 2024 1

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.

moorereason avatar moorereason commented on May 3, 2024

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.

adnanh avatar adnanh commented on May 3, 2024

What to do with stderr? Should it be merged with stdout, or just print out the stdout without stderr?

from webhook.

adnanh avatar adnanh commented on May 3, 2024

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.

gdubicki avatar gdubicki commented on May 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.