0

The trouble is that we have our repository hosted by an external party, preventing hook scrips due to the security issues executing arbitrary scripts could bring. Hook scripts are therefore no option for me. A quick email with our host revealed that Trac offers a Notification functionality which offers HTTP POST and GET commands which could be used to trigger a Jenkins build. I cannot get it to work! Below I have attached my efforts in trying to get it to work, to no avail. Does anyone have a clue where I'm going wrong?

The notifications can be set in Trac under: , "Dashboard", "Notifications", section "Web Hooks".

The fields are:

Custom GET Callback (HTTP GET to a URL of your choice)

  • URL:
  • Username: (optional)
  • Password: (optional)

Custom POST Callback (JSON or XML POST to a URL of your choice)

  • URL:
  • Username: (optional)
  • Password: (optional)
  • HTTP Header: (optional)

I have tried the following, to no avail:

Adrian vdBoom
  • 83
  • 1
  • 7

2 Answers2

1

I needed to install the "Build Authorization Token Root" plugin, which can be downloaded here: https://plugins.jenkins.io/build-token-root

Then I set up a custom GET callback in the Notification area of the Trac project settings, like this:

Now it works! Thanks elworthy!

Adrian vdBoom
  • 83
  • 1
  • 7
0

The build_token approach is deprecated, as per this post (https://issues.jenkins-ci.org/browse/JENKINS-17764) see last comment from Daniel Beck:

"Token-based build triggering is a legacy option that has been deprecated years ago (just the docs haven't been kept up to date)...."

I don't use TRAC but trigger builds remotely using code below (userid/token/job/url values need to be set) - might help?:

AUTH="<user_id>:<user_api_token>"
JOB_NAME="<job_name>"
TRIGGER_URL="http://<jenkins>:8080/job/$JOB_NAME/buildWithParameters?param1=value1&param2=value2"
curl -D - -X POST -u $AUTH $TRIGGER_URL 2>&1`
elworthy
  • 454
  • 4
  • 12
  • Although it has not proven to be the solution for me, you did point out what I did wrong! Also, in the link you have shared I managed to find my solution. As Emil Dragu said in your link: "I had the same problem, to workaround I used this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Build+Token+Root+Plugin. Hope it helps." – Adrian vdBoom May 22 '18 at 12:32