Thursday 30 June 2016

Jenkins Webhook, Only build Specific Branch after receiving web hook. e.g. only build master

With a web hook a request is made regardless of which branch it is on. Initially this would cause my Jenkins to initiate a build (on master) even when the commit was pushed to develop. To fix this we can follow these steps:


  • Open your jenkins project
  • configure it to use: Poll SCM (but leave the schedule blank)
  • save and exit

in Bitbucket / Github create a web hook and enter the following url (replacing your jenkins & git project details)

http://<your domain>/jenkins/git/notifyCommit?url=<your git repository url>
eg

http://fakewebsite.com:8080/jenkins/git/notifyCommit?url=git@bitbucket.org:faceuser/fakeproject.git

This will do the following:

  1. Send a web hook request to your jenkins
  2. Jenkins will process this request and look for Jenkins projects using the specified gitproject (e.g. git@bitbucket.org:faceuser/fakeproject.git)
  3. Jenkins will then poll git looking for changes on the specified branch





Jenkins unable to post to twitter due to Twitter-plugin not using SSL

Same problem as this
https://issues.jenkins-ci.org/browse/JENKINS-25740

 but the solution was to also replace jar the following files under
$jenkinsdir/plugins/twitter/WEB-INF/lib

twitter4j-core-3.0.3.jar with twitter4j-core-3.0.5.jar
twitter4j-async-3.0.3.jar with twitter4j-async-3.0.5.jar

Download from
http://central.maven.org/maven2/org/twitter4j/twitter4j-core/3.0.5/

reload jenkins deployment in tomcat manager and voila! it works!

Wednesday 29 June 2016

Jenkins job cannot create dirs under /home/jenkins/.m2/

ssh to the machine and check who ones the files/dirs if it owned by root change it to the tomcat users
sudo chown -R username:group directory