Stash External Hooks - Documentation not available

max_at January 29, 2014

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

0 votes
Answer accepted
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2014

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

max_at January 29, 2014

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

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2014

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

Stanislav Seletskiy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2014

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.

max_at January 29, 2014

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

Stanislav Seletskiy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2014

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

0 votes
Stanislav Seletskiy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2014

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
TAGS
AUG Leaders

Atlassian Community Events