Stash External Hooks - Documentation not available

Hello,

External Hooks documentation is not reachable at the moment for this plugin:
https://marketplace.atlassian.com/plugins/com.ngs.stash.externalhooks.external-hooks

Is there another address or place to get the information?https://marketplace.atlassian.com/manage/plugins/com.ngs.stash.externalhooks.external-hooks/versions

Alternatively I am searching for that example shellscript mentioned on the plugins page to see all possible parameters.

Thanks, Max

2 answers

1 accepted

Hi Max,

I'm not sure there is any documentation (I think that might be the default Marketplace location but I'm not sure).

You can see the parameters here:

https://github.com/ngsru/atlassian-external-hooks/blob/master/src/main/java/com/ngs/stash/externalhooks/hook/ExternalPreReceiveHook.java#L46

https://github.com/ngsru/atlassian-external-hooks/blob/master/src/main/java/com/ngs/stash/externalhooks/hook/ExternalPostReceiveHook.java#L39

You can see that the pre-receive has the advertised STASH_USER_NAME and STASH_USER_EMAIL values, but for some reason the post-receive doesn't (it would be easy enough to fix).

I've sent an email to the author to see if he can fix (or remove) that documentation link.

Charles

Hi Charles,

thanks for interventing and helping me with the author.
Poorly I am bad a reading that java code to get the parameters for post-recieve.

I see that it splits the input from stash line by line to get the args - but what are the possible parameters that can be set in stash?

Max

Oh, apologies. I wasn't thinking. I've answered that here:

https://answers.atlassian.com/questions/222993/how-do-i-uses-external-hooks-with-positional-parameters

$1 = before hash

$2 = after hash

$3 = ref id (branch)

Does that help?

Charles

Hello, Max!

I'm maintainer for this plugin. All positional arguments that you will specify in the hook configuration will passed as is to the script, no variable expansion in any kind will be made. However, script will be executed from git directory, so you have full access to the repository and can safely run such commands as "git diff" in your script.

I'm sorry for lack of docs and I'l fix it soon.

Hello Stanislav, and Charles again,

Thanks for your answers, I just tried some of the params I found or thought about and those always got sent plain without "parsing". Stanislav's answer gives me the same info - whatever is written in this box will just sent plain as parameters (each line one parameter).

Therefore i was thinking wrong (eg: REF_NAME would produce max.dev in the output).

Thanks for clearing up the fog ..

Max

You can get REF_NAME by reading STDIN, like that (in bash):

while read from_sha to_sha ref_name; do
	echo $ref_name # do something with $ref_name
done

You can see that the pre-receive has the advertised STASH_USER_NAME and STASH_USER_EMAIL values, but for some reason the post-receive doesn't (it would be easy enough to fix).

Oh, I've simply forgot to commit, I'l fix it soon.

All documentation available for plugin at this moment is a description written under "Details" tab.

I will definitely write some documentation and fix that link, but it take some time.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

175 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you