6
votes

Currently I am trying to build CI/CD pipeline for my micro service deployment. I created declarative pipeline script including repository pull, build, test, Kubernetes deployment etc in different stages. And I am trying to trigger post-commit script that need to initiate Jenkins job for each commit to repository.

When I am trying to create Jenkins job, I chose the New -> Free Style option. But there is no area where I can add my pipeline script.

And when I chose New -> Pipeline, I have space for adding pipeline script. But I don't have the option of Source code management for adding my repository checkout link and all.

When I observed, I only seeing source code management option in free style. But it don't have any area for adding my pipeline script.

Here I need to add my declarative pipeline script and also I need to refer my SVN source code management. And I am storing script in Jenkins itself.I am not using Jenkinsfile (Poll From SCM option). How I can add in jenkins job ? Do I need to add in Free style or pipeline?

1

1 Answers

5
votes

If you'd like your Jenkins job to be triggered on each commit, then it's the SVN server that has to trigger the job. This can be done with a post-commit hook. I assume you are using the Subversion plugin in Jenkins. SVN Plugin documentation explains how to create a commit hook: https://wiki.jenkins.io/display/JENKINS/Subversion+Plugin

This approach has got at least three advantages over polling:

  1. Polling can only happen once a minute, which means you won't be able to trigger the job on each commit
  2. Polling stops while the job is busy, while the commit hook will keep adding jobs on the queue, guaranteeing that each commit is checked separately. This can be a disadvantage too: when the job takes too long to execute, and there are many commits, then throughput time for each commit can become annoyingly long
  3. Polling every minute introduces additional load on your SVN server