Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

External Hook executes but does't return any remote output

Matthew Trisoline
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 27, 2014

The external hook plugin works and executes as expected but doesn't return any output via git remote

I am just trying to do some post operations but I want those remote operations to be visible to the users.

~/git/stash-test $ git push origin master
Counting objects: 13, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 292 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To git@git.priv.intermedix.com:stas/stash-test.git
   5bfd072..661a51e  master -> master
#!/bin/bash
(
        echo "Script name: $0"
        echo "Positional arguments: ${@}"
        echo "STASH_USER_NAME: $STASH_USER_NAME"
        echo "STASH_USER_EMAIL: $STASH_USER_EMAIL"
        echo "STASH_REPO_NAME: $STASH_REPO_NAME"
        echo "STASH_IS_ADMIN: $STASH_IS_ADMIN"
        while read from_ref to_ref ref_name; do
                echo "Ref update:"
                echo " Old value: $from_ref"
                echo " New value: $to_ref"
                echo " Ref name:  $ref_name"
                echo " Diff:"
                git show $to_ref | sed 's/^/  /'
        done
) | tee -a /tmp/external-hooks-test.log
Script name: /opt/test.sh
Positional arguments: test_param
STASH_USER_NAME: matt.trisoline
STASH_USER_EMAIL: matt.trisoline@intermedix.com
STASH_REPO_NAME: stash-test
STASH_IS_ADMIN: true
Ref update:
 Old value: 5bfd07267a472b56c8392aa0c97ef9f971619aa3
 New value: 661a51efdb350d1a4a00722c654b1cfb96771502
 Ref name:  refs/heads/master
 Diff:
  commit 661a51efdb350d1a4a00722c654b1cfb96771502
  Author: Matthew Trisoline <matt.trisoline@intermedix.com>
  Date:   Mon Oct 27 17:26:17 2014 -0400
  
      test15
  
  diff --git a/bang b/bang
  index db791df..a3af400 100644
  --- a/bang
  +++ b/bang
  @@ -1,4 +1,3 @@
  -asdgdaghdagjkha
   astghkasd;lthasdfasfasdfsadfasfd
   agtjkhahga
   atgkjhajl;dths

1 answer

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.
October 27, 2014

Please, read section in https://github.com/ngsru/atlassian-external-hooks/wiki/Configuration about configuration.


Currently, Stash run all post-receive asynchronously, so it's Stash limitation. Currently there is no way to get output from post-receive hook.

However, you can give feedback to user in pre-receive hook, it will receive all data that post-receive hook can receive, so it's should be no problem.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events