0

I fear that this may be a duplicate of some issue and if so I apologize. Permit me to describe what I would like in full and perhaps the community could point me to the components.

My Setup:

  • docker-mac kubernetes cluster.
  • Jenkins running as a service in my local cluster using nginx-ingress at something like jenkins.local.com.
  • ~/jenkins_home on my local machine is mapped to /var/jenkins_home in the container image thus exposing my localhost filesystem
  • ~/code/github exposed to /var/github on the container image as well.

I keep my various repositories in ~/code/github or ~/code/scm in general. The behavior I would like is as follows...

  • I make a commit, locally, not pushed to any branch on ~/code/github/my_project.
  • Jenkins sees this in its filesystem and triggers a build by running the Jenkinsfile of ~/code/github/my_project/Jenkinsfile

This would provide me with a development loop for local development based on Jenkins that could provide me with quick feedback on tests without me pushing to a branch on the scm.

What are my options for making Jenkins react to each commit in this way?

Luis
  • 41
  • 2
  • Possible duplicate: https://stackoverflow.com/questions/12794568/how-to-configure-git-post-commit-hook – Daniel Feb 19 '19 at 18:54
  • Hello Daniel, after reading stackoverflow.com/questions/12794568/… it doesn't seem like it's a duplicate because that question addresses building on a commit after the commit has been pushed to the remote repository where as I would like Jenkins to build on commit that has not been pushed to any branch. – Luis Feb 19 '19 at 19:17
  • post-commit hook should still be triggered on a local commit. Push would trigger a post-receive hook. I think the tricky part is that you would have to specify your local repository in the `curl http://yourserver/jenkins/git/notifyCommit?url=` command since the remote repository does not have the changes until they are pushed. – Daniel Feb 19 '19 at 20:10
  • If your main goal is use Jenkins and github in a real environment, your approach is far far away. Check this https://stackoverflow.com/a/54700312/3957754 to get an idea of how devops flows works using Jenkins and github – JRichardsz Feb 20 '19 at 00:42

0 Answers0