#StackBounty: #jenkins #svn Jenkins Job auto Triggering when code commit on SVN repo using POST COMMIT hook

Bounty: 100

I am trying to implement CI/CD pipeline using Jenkins , docker and Ansible. I am using SVN code repository for my version control system. For deployment and SVN code repo , I am using AWS EC2 . Deployment and code repo is in separate VM.

My Requirement

When I am committing my code into SVN repository , I need to trigger one Jenkins Job. That job will call a ansible playbook.Later it will build project , build docker image and deploy into EC2. So for any change to my SVN code repository , need to build Jenkins job.

My Current Attempt

I added the folowing script in post-commit.tmpl file under $repo/hooks folder.

REPOS="$1"
REV="$2"
UUID=`svnlook uuid $REPOS`
/usr/bin/wget 
  --header "Content-Type:text/plain;charset=UTF-8" 
  --post-data "`svnlook changed --revision $REV $REPOS`" 
  --output-document "-" 
  --timeout=2 
  http://server/subversion/${UUID}/notifyCommit?rev=$REV

The following is the screesnhot

enter image description here

And Checked the “Poll SCM option in Jenkins Job” ,

enter image description here

NB: I am not looking miniute/hours/week schedule to pull from repo. Instead of that , I am looking when there is a code change , then I need to build jenkins project.So I did not added any schedule

But Stiil I am not getting the latest code in jenkins.Can anyone help me to findout the issue related with my configuration please?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.