how can I monitor a repository without having to check out code into jekins workspace

42 views
Skip to first unread message

gorill...@gmail.com

unread,
Mar 26, 2014, 1:34:18 PM3/26/14
to jenkins...@googlegroups.com
Hello-

I want to monitor a git repository and run a script where then is a change. I've puzzled over it for a while now, and I cannot figure this out. If I use "Source Code Management" and fill out my particulars about my git repository, Jenkins tries to checkout the code into a local workspace. Is there any way to monitor a repository and act on it without this inherent checkout into a workspace? I'm sure there is a way to do it, but I don't see it in the interface.

-Thanks!

Vivekanand S V

unread,
Mar 26, 2014, 11:25:26 PM3/26/14
to jenkins...@googlegroups.com
Try enabling "Poll SCM" option ? I never tried that though, I think that checks for changes and then builds (only if there are any changes)


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Waite

unread,
Mar 26, 2014, 11:43:18 PM3/26/14
to jenkins...@googlegroups.com
I don't know of any way to use Jenkins to monitor a git repository for changes without including a checkout of a local workspace.

Conceptually, I think you could write your own plugin which would rely on the git-client-plugin and perform the check for changes without creating a local workspace.  GitClient.getHeadRev() is able to list the branches on a remote repository, so it should be possible.

Mark Waite
--
Thanks!
Mark Waite

Richard Bywater

unread,
Mar 26, 2014, 11:48:09 PM3/26/14
to jenkins...@googlegroups.com
Could a git hook do what you are trying to do?

Richard.
--

Ruddy Gbaguidi

unread,
Mar 27, 2014, 9:46:17 AM3/27/14
to jenkins...@googlegroups.com

Maybe you can have an empty job that just execute a shell script.

That job can run periodically every X minutes.

Then your script will “manually” verify the repository and act if there is a change.

So, don’t let Jenkins do the check> Do it yourself in your script and let Jenkins call your script periodically.

 

It should work.

michele Hallak-Stamler

unread,
Mar 30, 2015, 4:07:33 AM3/30/15
to jenkins...@googlegroups.com
Using the solution of plugworld will work but the changes will not be documented.
I have a real problem with the git plugin since we have to use filters for header expansion. It doesn't work with git init + fetch.
It works with git clone but that's not the selected implementation of the git plugin.
So I am doing the git clone in my script but I would like to have the changes in Jenkins....
If someone finds a solution, I'll be happy to hear about....
For now, there are just two solutions:
1. Make the GIT repository polling on one Jenkins server without using filters and then call another job on another machine that would do the git clone with gitfilters.
2. Change online the .gitconfig: add/remove filters according the jobs; one job using the gitplugin and w/o gitfilters. Then a job with git filter that performs the git clone in the script.
Is there another solution that I didn't figure out?
Thanks
Michele

On Thursday, March 27, 2014 at 3:46:17 PM UTC+2, plugworld wrote:

Maybe you can have an empty job that just execute a shell script.

That job can run periodically every X minutes.

Then your script will “manually” verify the repository and act if there is a change.

So, don’t let Jenkins do the check> Do it yourself in your script and let Jenkins call your script periodically.

 

It should work.

 

 

From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of Richard Bywater
Sent: March 26, 2014 11:48 PM
To: jenkins...@googlegroups.com
Subject: Re: how can I monitor a repository without having to check out code into jekins workspace

 

Could a git hook do what you are trying to do?

 

Richard.

On Thursday, March 27, 2014, <gorill...@gmail.com> wrote:

Hello-

 

I want to monitor a git repository and run a script where then is a change. I've puzzled over it for a while now, and I cannot figure this out. If I use "Source Code Management" and fill out my particulars about my git repository, Jenkins tries to checkout the code into a local workspace. Is there any way to monitor a repository and act on it without this inherent checkout into a workspace? I'm sure there is a way to do it, but I don't see it in the interface.

 

-Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages