0
votes

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:

2

2 Answers

1
votes

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!

0
votes

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`