Hi,
I’m currently running a Gitlab docker container, I’ve configured a post-receive to trigger a task in jenkins for a particular project, the post-receive seems to be executing but is stopping and the jenkins task is not running for the particular project.
#!/bin/bash
# Get branch name from ref head
if ! [ -t 0 ]; then
read -a ref
fi
IFS='/' read -ra REF <<< "${ref[2]}"
branch="${REF[2]}"
if [ $branch == "master" ]; then
crumb=$(curl -u "jenkins:1234" -s 'http://jenkins:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
curl -u "jenkins:1234" -H "$crumb" -X POST http://jenkins:8080/job/maven-job/build?delay=0sec
if [ $? -eq 0 ] ; then
echo "Ok Computer"
else
echo "Error Computer"
fi
fi
The script seems to be executing, but seems to stop on the echo “Ok Computer” line.
➜ maven git:(master) git push origin master
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 185 bytes | 185.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: % Total % Received % Xferd Average Speed Time Time Time Current
remote: Dload Upload Total Spent Left Speed
remote: 100 70 100 70 0 0 1296 0 --:--:-- --:--:-- --:--:-- 1320
remote: <h1>Bad Message 400</h1><pre>reason: Illegal character VCHAR='<'</pre>Ok Computer
To http://gitlab.example.com/jenkinsci/maven.git
835a7ca..ecfb7f1 master -> master
Any advice regarding this issue?