模拟Jenkins的POST webhook?

时间:2014-08-15 16:45:14

标签: jenkins http-post webhooks

模拟webhook的方法是什么,只是为了测试Jenkins上的内容?

我跑

curl --header 'Content-Type: application/json' --request POST --data 'payload={}' 'http://172.28.22.60:8080/github-webhook/'

在詹金斯的日志中,我最终得到了

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalArgumentException: Not intended to be browsed interactively (must specify payload parameter)
    at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:168)
    ... 53 more

1 个答案:

答案 0 :(得分:0)

Subversion post-commit hook的代码是否有帮助?

HEADER="Content-Type:text/plain;charset=UTF-8"
CRUMB=`$WGET --auth-no-challenge --output-document - ${CISERVER}/${CRUMB_ISSUER_URL}`
if [ "$CRUMB" != "" ]; then HEADER=$CRUMB; fi

$WGET \
    --auth-no-challenge \
    --header $HEADER \
    --post-data "`$SVNLOOK changed --revision $REV $REPOS`" \
    --output-document "-"\
    --timeout=2 \
    ${CISERVER}/${NOTIFY_URL}