La commande curl fonctionnant parfaitement échoue lorsqu'elle est exécutée dans un script groovy

J'ai un post commit hook (un script groovy) dans gitblit d'invoquer un point de terminaison REST. Dans ce script, je suis de l'exécution d'une commande curl. Mais il semble échouer. La commande curl fonctionne très bien lorsqu'il est exécuté depuis la ligne de commande.

Voici mon script 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:[email protected]:9443/restendpoint".execute().text
println response 

référentiel est transmis par gitblit pour ce script et j'ai vérifié.

Quelqu'un peut-il m'aider avec cela.

source d'informationauteur Amila Maharachchi