reconquest / atlassian-external-hooks

External Hooks plugin for Atlassian Bitbucket
https://external-hooks.reconquest.io
Other
44 stars 37 forks source link

Add STASH_REF_CHANGES environment variable. #35

Closed exception0x876 closed 4 years ago

exception0x876 commented 8 years ago

This variable is useful for performing an action only if specific branches have changed.

seletskiy commented 8 years ago

@exception0x876: Pls, remove trailing space from variable value.

bturner commented 5 years ago

Not my app, so not my decision, but why would you add these like this? External hooks are streamed the ref changes, which includes all the IDs, on their stdin. Passing ref IDs in the environment is wasteful/unnecessary.

More importantly, though, passing them in the environment is dangerous. When Bitbucket Server is hosted on Windows, the total environment block (all variables together) has a hard size limit. This code doesn't check how many IDs it's setting, or how large the resulting variable is. An initial push for a new repository created from an existing repository could easily exceed Windows's environment limit, causing the script to fail to start.

If your script wants to react to specific refs, read stdin and check the ref IDs there.

seletskiy commented 5 years ago

@bturner: that is good point and this change was not added to upstream version (hence PR is open).

seletskiy commented 4 years ago

Script stdin could be used to get ref changes.