I tried to configure tuleap-jenkins integration as descibed in: https://tuleap-documentation.readthedocs.io/en/latest/user-guide/pullrequest.html#configure-tuleap-to-jenkins-trigger
STEPS TAKEN (steps to reproduce):
- Created Jenkins job with following params in Source Code Managment section
- Git
- Repositories:
- https adress of my repository
- Valid credentials
- Name: origin
- Refspec: +refs/tlpr/*:refs/remotes/origin/pr/*
- Branch Specifier: $COMMIT_ID
- Build triggers:
- poll SCM, no schedule provided (should be build only on notification)
- Configured Jenkins Webhook :
- Git -> repo->Settings-> Webhooks -> Add Jenkins Webhook
- Provide adress of my Jenkins instance
- Saved, validated
- Change pushed to repo (
- sha1: 5f137c5d2c8069ec38372b048a9e898ec88b33a6)
EXPECTED BEHAVIOR:
Git pooling shal not be performed (no updates of 'Git polling logs')
Jenkins job shall be invoked for specific commit.
Jenkins should state that is beeing triggered by commit_notification and with exact revision:
commit notification 5f137c5d2c8069ec38372b048a9e898ec88b33a6
Revision: 5f137c5d2c8069ec38372b048a9e898ec88b33a6
ACTUAL BEHAVIOR:
If $COMMIT_ID is provided as stated in document:
- git polling will try to search all branches but end up wioth message that no changes mathching defined pattern (No changes found).
- Job will not be triggered (since there is nothing to be built)
If $COMMIT_ID is ommited:
- Git will scann all branches for changes
- Git will found any change (probably un-related to one we pushed) and built it
INVESTIGATION:
It seems that jenkins webhook uses notifyCommit endpoint (provided by jenkins git plugin).
notifyCommit expect three parameters:
- Repo url (mandatory)
- List of branches to be checked (optional)
- Sha1 id of commit to build (optional) - If set, it will trigger a build immediately, without polling for changes.
I logged all incoming http request from Forge toward Jenkins and it seems that tuleap JenkinsWebHook ommit [branches] and [sha1] parameters:
Jan 22, 2019 3:53:04 PM FINE hudson.plugins.git.GitStatus
Received notification from my_forge_instance ⇒ https://my_jenkins_instance:8080/git/notifyCommit for uri = ssh://gitolite@my_forge_instance/test/test.git ; sha1 = null ; branches = []
Jan 22, 2019 3:53:04 PM FINE hudson.plugins.git.GitStatus
Received notification from my_forge_instance ⇒ https://my_jenkins_instance:8080/git/notifyCommit for uri = https://my_forge_instance/plugins/git/test/test.git ; sha1 = null ; branches = []
Also, I noticed that, for each commit, two request are sent (http and ssh one) wich is also bit wierd...
When notifyCommit request is manualy forged (using curl) it provided both params (after that, jenkins works correctly) as shown:
Jan 22, 2019 3:52:24 PM FINE hudson.plugins.git.GitStatus
Received notification from my_forge_instance ⇒ https://my_jenkins_instance:8080/git/notifyCommit for uri = ssh://gitolite@my_forge_instance/test/test.git ; sha1 = 5f137c5d2c8069ec38372b048a9e898ec88b33a6 ; branches = []