我在gitblit中有一个提交后钩子(一个Groovy脚本),用来调用REST端点。在这个脚本中,我执行了一个curl命令。但它似乎失败了。当从命令行执行curl命令时,它正常工作。
以下是我的Groovy脚本:
#!/usr/bin/env groovy
def repoUrl= "https://gitblit.myhost.com/git/" + repository + ".git"
json='{"repository":{"url":"'+repoUrl+'"}}'
def response = "curl -v -k -X POST -H \"Content-Type: application/json\" -d '${json}' https://username:password@anotherhost.com:9443/restendpoint".execute().text
println response
gitblit将存储库传递给此脚本,我已经验证过了。
有人能帮帮我吗。