go-gitlab-webhook icon indicating copy to clipboard operation
go-gitlab-webhook copied to clipboard

support commands with arguments

Open oker1 opened this issue 10 years ago • 7 comments

oker1 avatar Jan 09 '15 14:01 oker1

Arguments would simply be provided like?

"commands": [
        "/home/bar/deploy.sh -t",
        "/home/bar/cleanup.sh --speed -t --retry-once"
      ]

soupdiver avatar Jan 09 '15 19:01 soupdiver

It's not working that way because exec.Command's first parameter is the executable, the rest are the parameters. You'll get an error that it can't be executed.

oker1 avatar Jan 09 '15 20:01 oker1

Ok, so can you give an example how to provide the arguments?

soupdiver avatar Jan 09 '15 20:01 soupdiver

Using @oker1 fork following command works

gitlab-webhook     | 2016/03/22 10:47:12 Executed: /usr/bin/git --git-dir=/repos/my_repo/.git pull origin master

whereas using @soupdiver master I have following error

gitlab-webhook     | 2016/03/22 10:45:32 fork/exec /usr/bin/git --git-dir=/repos/my_repo/.git pull origin master: no such file or directory

kakawait avatar Mar 22 '16 10:03 kakawait

@kakawait @oker1 I'm willing to merge the PR but please also update https://github.com/soupdiver/go-gitlab-webhook/blob/master/config.example.json so that there is an example on how to provide the arguments properly.

soupdiver avatar Mar 23 '16 10:03 soupdiver

You don't have to change the config, the command is split up at spaces.

oker1 avatar Mar 23 '16 11:03 oker1

Yes config.json from my previous sample is strictly the same!

kakawait avatar Mar 23 '16 12:03 kakawait