|
This plugin allows use of GIT as a build SCM. Git 1.3.3 or newer is required.
Plugin Information
Bugs
Note: The latest master repository seems to be http://github.com/hudson/Hudson-GIT-plugin. Gotchas
Started by user anonymous
Checkout:workspace / C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace - hudson.remoting.LocalChannel@1a1f370
Last Build : #4
Checkout:workspace / C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace - hudson.remoting.LocalChannel@1a1f370
Cloning the remote Git repository
Cloning repository origin
$ git clone -o origin git://github.com/bret/watir.git "C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace"
Trying next repository
ERROR: Could not clone from a repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:400)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:358)
at hudson.FilePath.act(FilePath.java:676)
at hudson.FilePath.act(FilePath.java:660)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:358)
at hudson.model.AbstractProject.checkout(AbstractProject.java:833)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:314)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:266)
at hudson.model.Run.run(Run.java:948)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:118)
ChangelogNext release (in master)
Version 1.0.1 (released August 9, 2010)
Version 1.0 (released July 29, 2010)
Version 0.9.2 (released June 22, 2010)
Version 0.9.1 (released June 22, 2010)
Version 0.9 (released June 17, 2010)
Version 0.8.2
Version 0.7.3FIXME this changelog entry is incomplete! Please give me some love!
Version 0.5
Version 0.4 (never released)
Version 0.3
Version 0.2
Version 0.1
Advanced FeaturesUsing Git, Hudson and pre-build branch mergingContinuous Integration tools such as Hudson are useful on projects as they give users early indication that a particular codebase is 'unstable' - and that if a developer checks it out, there will be trouble ahead (they won't be able to work on their own code, because someone else has broken something). Unfortunately, by the time the build completes, this is often too late (particularly if the build cycle time is very long), as a developer has updated their working copy to the latest, unstable code in the repository and has begun work. This can lead to the code base remaining unstable as developers tread on each others toes steadily fixing one thing, but breaking something else. Some environments (e.g. TeamCity) attempt to fix this by making commits into SVN only 'really' happen once they have been tested. These kinds of 'delayed-commits' are problematic, because local SCM tools assume that commits will be immediately available, which can confuse them. In many ways this mechanism is a hack to get around the fact that branch management in SVN is very heavyweight. Fortunately, with GIT and Hudson, you can achieve the same 'stable branches' with minimal effort. Set up your hudson project, and leave the 'branch' field in the Git SCM blank. This will cause Hudson to consider any change on any branch for building. Next, pick a particular branch name as the integration target in the 'Advanced' section - (e.g. 'master', or 'stable'), and select 'Merge before build'. Select 'Push GIT tags back to origin repository' from the post-build actions (this is required to update your centralised git repo with the results of the build). Now, developers should never commit directly to your integration branch (the 'master' or 'stable'). Instead, they should either use feature branches, or create new remote branches on commit (e.g : "git push origin HEAD:refs/heads/myNewFeature"). You could also set up your GIT repository to only accept commits onto the integration branch from Hudson. You're done. Commits should now be automatically merged with the integration branch (they will fail if they do not merge cleanly), and built. If the build succeeds, the result of the merge will be pushed back to the remote git repository. Using Extra RepositoriesSince GIT is a Distributed SCM, it is possible in the Advanced section to specify multiple repositories. You may wish to do this to, for example, pull all in-progress work from individual developers machines, and pre-test them before they are committed to a centralised repository - this way developers may get an early warning that a branch in progress may not be stable. The GIT plugin will make reasonable attempts to try and pull submodule states from distributed repositories, with the proviso that this feature is not currently well supported within GIT itself. Autogenerate submodule configurationsA common development pattern for many users is the use of a 'superproject' that aggregates a number of submodules. For example, ProjectA may have ComponentA, ComponentB and ComponentC. ComponentA is a shared library, and is set to use a particular revision (maybe on a branch called 'ProjectA' in case there are any changes). Usually, any changes to the project configuration require a commit to the ProjectA superproject. However - there could be other changes happening on other branches of ComponentA (say to the development of the next version). Without someone generating commits into ProjectA to test these, any regressions or incompatibilities may be missed. The autogenerate submodule configurations feature will create commits into ProjectA for all possible combinations of the branches present in the submodules that the project uses. |
Comments (32)
Jun 23, 2009
Kohsuke Kawaguchi says:
Through rtyler: http://github.com/stephenh/git-central/blob/master/server/post-r...Through rtyler: http://github.com/stephenh/git-central/blob/master/server/post-receive-hudson automates the set up of a Hudson job whenever a new branch is created. Nice.
Jul 22, 2009
J. Longman says:
How do I build a specific revision? I used to be able to specify a build should ...How do I build a specific revision? I used to be able to specify a build should use SHA1-ID, like build origin/bdbbfc3f0e9c57fbeff89de2ad7ca308a168575e and it would work. This is necessary for reproducibility.
Has this changed? How do I do this now?
Nov 17, 2009
Kenneth P. Turvey says:
I wrote a tutorial on getting hudson to work with git and grails. It inclu...I wrote a tutorial on getting hudson to work with git and grails. It includes all the information necessary to set up an integration server using git and hudson even if you aren't interested in grails development:
http://www.electricsenator.net/2009/10/03/1254618530821.html
Nov 18, 2009
Graeme Simpson says:
Is it possible to use credentials when accessing a git repository? Or certificat...Is it possible to use credentials when accessing a git repository? Or certificates?
Thanks,
Graeme
Jan 01, 2010
Chas Emerick says:
Is there any way to get the git plugin to checkout ref names instead of the sha'...Is there any way to get the git plugin to checkout ref names instead of the sha's associated with remote refs? Not being on a branch in the course of a build is causing issues (for at least two of us) in conjunction with the M2 Release Plugin:
Can’t get automated release working with Hudson + Git + Maven Release Plugin
Feb 02, 2010
Chas Emerick says:
This issue has been resolved for me as of v0.8.0 of the git plugin. See my...This issue has been resolved for me as of v0.8.0 of the git plugin. See my comment below.
Mar 17
David Antliff says:
Really? I'm using 0.8 (by using the Hudson plugin upgrader) and still seeing Hud...Really? I'm using 0.8 (by using the Hudson plugin upgrader) and still seeing Hudson check out a specific SHA-1 rather than a reference:
even though I specified "origin/myBranch" in the Branch Specifier field. This detaches HEAD and makes it impossible (or very hard at least) for a subsequent build script to know what branch it's building on.
Jan 06, 2010
Brad Robertson says:
I can't get Hudson to merge into the master branch. It always ends up in *no br...I can't get Hudson to merge into the master branch. It always ends up in *no branch, which is no good to me as I want to push master to another remote repo as a deploy.
I've set the following:
refspec: +refs/heads/master:refs/remotes/origin/master
branch to build: */master
branch to merge to: master
The Git logs show it fetching the latest, then for some reason checking out the previous version with the sha, which puts it into *no branch. Then it does a git merge with the latest, still on *no branch. I've included the logs below.
I don't think this is the correct behavior given that I specify that I want to merge to the master branch. Thoughts? Bug?
Git logs from hudson:
git fetch /home/git/repositories/my_repo.git +refs/heads/master:refs/remotes/origin/master
git ls-tree HEAD
git rev-parse master
git checkout -f old_rev_sha here's where it switches branches
git merge new_rev_sha
Jan 08, 2010
Chas Emerick says:
I don't know if this is a bug, but +1 that this isn't correct behaviour IMO (see...I don't know if this is a bug, but +1 that this isn't correct behaviour IMO (see my comment directly above yours).
Jan 09, 2010
Brad Robertson says:
ya i read that. I'm also confused as to why it's using sha's, especially when t...ya i read that. I'm also confused as to why it's using sha's, especially when the plugin allows you to specify the ref you want and the branch to merge to.
I personally do think it's a bug if you are specifying the branch to merge to and the fetched code is not merged to that branch
Feb 02, 2010
Chas Emerick says:
I upgraded to v0.8.0 of the git plugin, and have been able to perform a maven re...I upgraded to v0.8.0 of the git plugin, and have been able to perform a maven release using the Maven release plugin, and have the results successfully pushed back to master.
v0.8.0 appears to add a "Merge options" section (in the advanced tab under the SCM section of the project config). I put "origin" in 'name of repository' and "master" in 'branch to merge to', and the push went swimmingly.
Feb 11, 2010
Brad Robertson says:
Merge options were definitely available in 0.73. I mentioned above that I put i...Merge options were definitely available in 0.73. I mentioned above that I put in "master" as "branch to merge to" in my settings and it still didn't work. I haven't upgraded to 0.8 though so I'll check it out when I get a chance. I don't know how this can't be documented anywhere though.
Mar 16
David Antliff says:
Brad: did you have any success with 0.8 in this respect? I'm seeing Hudson conti...Brad: did you have any success with 0.8 in this respect? I'm seeing Hudson continue to check out the specific SHA rather than the branch reference, and therefore detach the HEAD.
Mar 17
Brad Robertson says:
To be honest, I haven't looked at this in quite some time, i'm working on a few ...To be honest, I haven't looked at this in quite some time, i'm working on a few projects so i've been fairly busy. I'll keep you posted when I find the time to see if this has been fixed for me.
Jan 11, 2010
Anonymous ultimo says:
Problems with new 0.8 version under windows. It looks very good and the new inf...Problems with new 0.8 version under windows.
It looks very good and the new information about changed files is great but scm polling doesn't work anymore
Feb 08, 2010
J. Longman says:
I'm also having problems, but I'm not using windows: Feb 8, 2010 11:51:03 AM h...I'm also having problems, but I'm not using windows:
Mar 16
David Antliff says:
Is there an inconsistency here? This page says 0.8 is the Latest Release, but th...Is there an inconsistency here? This page says 0.8 is the Latest Release, but the download link to the .hpi file is pointing at 0.7.3.
What is the download link to the 0.8 hpi please, as I need to archive this file for static installation at my site.
Mar 27
Evgeny Goldin says:
Hi, I have a problem with latest Hudson v1.352 and Git plugin v0.8.1. After fet...Hi,
I have a problem with latest Hudson v1.352 and Git plugin v0.8.1.
After fetching successfully Git sources - Maven fails with NPE
Here's the full log and job's configuration
Git plugin passes null value for GIT_BRANCH environment variable,
which later fails in MavenBuilder.java:156 when Maven plugin calls
System.getProperties().putAll(systemProps)
Here's a debugger screenshot.
Mar 27
Evgeny Goldin says:
Fixed it by specifying "master" as default branch, not empty and not "**...Fixed it by specifying "master" as default branch, not empty and not "**".
Posted it in my blog as well.
Apr 02
Mark Moore says:
I'm hoping this is the right place to post this question... It looks like ...I'm hoping this is the right place to post this question... It looks like the Git plugin simply issues a git fetch origin master (or something reasonably similar). I want to force a clean before fetching. specifically "git -fx clean" Does anyone know how to make this happen? I could add this to the build commands, but that seems a little wrong.
Help!
-Mark
Apr 02
David Antliff says:
What we do is issue the 'git clean' command as one of the first things the build...What we do is issue the 'git clean' command as one of the first things the build script (stored within the repository) executes. You could add it to the build command list if you wanted to, I don't think it's wrong. Hudson is just responsible for cloning/updating.
I just wish it checked out a ref instead of a commit, or at least set an environment variable to the specified branch name :)
May 06
Mik Lernout says:
This page should probably mention that the Git plugin relies on a recent version...This page should probably mention that the Git plugin relies on a recent version of the Git binaries (at least 1.7?).
Jun 15
Ian Eure says:
Same problem here with builds always starting from a detached HEAD. I'm using th...Same problem here with builds always starting from a detached HEAD. I'm using the most recent version of the plugin, 0.8.3.
My config is:
URL of repository: git://github.com/simplegeo/libmemcached.git Name of repository: origin Refspec: +refs/heads/*:refs/remotes/origin/* Branches to build: master Merge before build: Yes Name of repository: origin Branch to merge to: master Clean after checkout: Yes Choosing strategy: Default Repository browser: (Auto)These are the git commands that get run:
It's not merging anything, and it's still checking out a SHA-1 instead of a symbolic branch name. What gives?
Jun 18
Alexander Sparkowsky says:
I'm trying to figure out how the tags generated by the plugin for each build are...I'm trying to figure out how the tags generated by the plugin for each build are pushed back to the origin repository.
The text above mentions an option called 'Push GIT tags back to origin repository' but I'm not able to find it.
So how do I get the plugin pushing the tags for each build to the upstream repo?
Jun 25
ITDude says:
Folks, I'm experiencing problems setting up the GIT Plugin on a Debian system us...Folks, I'm experiencing problems setting up the GIT Plugin on a Debian system using a SSH key for authentication and was hoping somebody has had some experience with this setup who could offer some pointers.
I believe the problem is that it fails to find the key and thus present it to the GIT server. I've installed a valid key into the /usr/share/tomcat5.5/.ssh directory which is the home of the tomcat55 user but it fails with a ssh-askpass error.
Now I'm guessing that the process is running as the tomcat55 user but I could be wrong as looking at the logs below you can see that it is attempting to fetch to the /home/hudson directory. What's confusing about this is that the system does not have a user 'hudson' and in the System Information section of the web interface the enveronment looks as though it's running as the root user.
Here's the log output;
------------------
Started by user ITDude
Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@f74f6ef
Using strategy: Default
Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@f74f6ef
GitAPI created
Fetching changes from the remote Git repository
Fetching upstream changes from git@git.mycomp.com:test_hudson.git
[workspace] $ /usr/bin/git fetch -t git@git.mycomp.com:test_hudson.git +refs/heads/:refs/remotes/origin/
No protocol specified
(ssh-askpass:13369): Gtk-WARNING **: cannot open display: :0.0
Permission denied, please try again.
No protocol specified
(ssh-askpass:13370): Gtk-WARNING **: cannot open display: :0.0
Permission denied, please try again.
No protocol specified
(ssh-askpass:13371): Gtk-WARNING **: cannot open display: :0.0
Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR: Nothing to do
Finished: FAILURE
========================
The key is definitely valid as I've tested it with a manual connection.
Jun 25
Dale Hards says:
Hello, I'm having difficulties getting the git plugin to fetch from the reposit...Hello,
I'm having difficulties getting the git plugin to fetch from the repository. In the job's configuration I have provided:
URL of repository: git@git.mydomain.com:test_hudson.git
Name of repository: origin/master
Refspec: I leave this blank and it generates the following: +refs/heads/:refs/remotes/origin/master/
I have also provided the Branches to build: master
I have tried many different combinations of settings, and each one gives a different error message, but none of them are ever getting to the point where Ant builds my simple Java project. On the above settings, I get the following log:
***
Started by user daleh
Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@3219ab8d
Using strategy: Default
Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@3219ab8d
GitAPI created
Fetching changes from the remote Git repository
Fetching upstream changes from git@git.mydomain.com:test_hudson.git
[workspace] $ /usr/bin/git fetch -t git@git.mydomain.com:test_hudson.git +refs/heads/:refs/remotes/origin/master/
error: unable to resolve reference refs/remotes/origin/master/master: Not a directory
From git@git.mydomain.com:test_hudson
! [new branch] master -> origin/master/master (unable to update local ref)
error: some local refs could not be updated; try running
'git remote prune git@git.mydomain.com:test_hudson.git' to remove any old, conflicting branches
ERROR: Problem fetching from origin/master / origin/master - could be unavailable. Continuing anyway
[workspace] $ /usr/bin/git tag -l master
[workspace] $ /usr/bin/git rev-parse origin/master/master
ERROR: Nothing to do
Finished: FAILURE
***
As for needing to remove any "old conflicting branches", I have none. This is a simple project with no conflicting branches.
Thanks in advance for any help provided
Jun 27
Dale Hards says:
This has now been resolved through the mailing list. The problem was that origin...This has now been resolved through the mailing list. The problem was that origin/master is a branch not a repository. I needed to leave the repository blank (letting it be automatically set as "origin"), and supplying "origin/master" in the "build branch" setting. This fixed the problem fine.
Jul 13
Adam Szecowka says:
Hello, I have repoA and repoB, and i want clone repoA to directory for example w...Hello,
I have repoA and repoB, and i want clone repoA to directory for example workspace/myJob/A and clone repoB to workspace/myJob/B. Is it possible with this plugin ?
Jul 26
Dave Abrahams says:
Having Serious Submodule Problems. I confess that I don't understand what the d...Having Serious Submodule Problems. I confess that I don't understand what the documentation above about automatic submodule handling is trying to convey about what Hudson is doing, but whatever it is, it seems to be wrong. I'm content to do the git submodule init / git submodule update myself if necessary. Log below; can you please help? Thanks!
Started by user dave
Checkout:workspace / /var/lib/hudson/jobs/Boost/workspace - hudson.remoting.LocalChannel@3faa7a6a
Using strategy: Default
Last Built Revision: Revision 9fc9270750b81ec49fb96ee7b37fde5547da67c7 (origin/master)
Checkout:workspace / /var/lib/hudson/jobs/Boost/workspace - hudson.remoting.LocalChannel@3faa7a6a
GitAPI created
Cloning the remote Git repository
Cloning repository origin
$ git clone -o origin git://gitorious.org/ryppl/boost.git /var/lib/hudson/jobs/Boost/workspace
Fetching upstream changes from git://gitorious.org/ryppl/boost.git
[workspace] $ git fetch -t git://gitorious.org/ryppl/boost.git +refs/heads/:refs/remotes/origin/
[workspace] $ git ls-tree HEAD
GitAPI created
Fetching upstream changes from git://gitorious.org/ryppl/boost.git/cmake/.git
[cmake] $ git fetch -t git://gitorious.org/ryppl/boost.git/cmake/.git +refs/heads/:refs/remotes/origin/
fatal: protocol error: expected sha/ref, got '
----------------------------------------------
Cannot find repository /ryppl/boost.git/cmake/.git
----------------------------------------------'
ERROR: Problem fetching from origin - could be unavailable. Continuing anyway
[workspace] $ git submodule init
[workspace] $ git submodule update
[workspace] $ git tag -l master
[workspace] $ git rev-parse origin/master
Commencing build of Revision 9fc9270750b81ec49fb96ee7b37fde5547da67c7 (origin/master)
GitAPI created
Checking out Revision 9fc9270750b81ec49fb96ee7b37fde5547da67c7 (origin/master)
[workspace] $ git checkout -f 9fc9270750b81ec49fb96ee7b37fde5547da67c7
[workspace] $ git submodule init
[workspace] $ git submodule sync
Fetching upstream changes from git://gitorious.org/ryppl/boost.git
[workspace] $ git fetch -t git://gitorious.org/ryppl/boost.git +refs/heads/:refs/remotes/origin/
[workspace] $ git ls-tree HEAD
GitAPI created
Fetching upstream changes from git://gitorious.org/ryppl/boost.git/cmake/.git
[cmake] $ git fetch -t git://gitorious.org/ryppl/boost.git/cmake/.git +refs/heads/:refs/remotes/origin/
fatal: protocol error: expected sha/ref, got '
----------------------------------------------
Cannot find repository /ryppl/boost.git/cmake/.git
----------------------------------------------'
ERROR: Problem fetching from origin - could be unavailable. Continuing anyway
[workspace] $ git submodule update
[workspace] $ git tag -a -f -m "Hudson Build #4" hudson-Boost-4
Recording changes in branch origin/master
[workspace] $ git whatchanged --no-abbrev -M --pretty=raw 9fc9270750b81ec49fb96ee7b37fde5547da67c7..9fc9270750b81ec49fb96ee7b37fde5547da67c7
Triggering default
Finished: FAILURE
Aug 06
Vincent Driessen says:
The error occurs directly after the "git ls-tree HEAD" command. Assuming a defau...The error occurs directly after the "git ls-tree HEAD" command. Assuming a default Git repo setup, HEAD refers to "master" at that stage. I think the output of that process is scanned and each entry that has mode flag 160000 (= submodule commit) is filtered out and processed accordingly.
How it detects and fetches from the submodule URL? I have no clue at all, but I know it's wrong.
Furthermore, I have a branch called "develop" that does NOT have a submodule commit, but my master does. Even it I configure a Hudson job to fetch from branch "develop", it still uses "git ls-tree HEAD" to scan/parse for submodules, before switching to "develop", also breaking those builds. I've filed this as a bug on the Git plugin issue list (see http://github.com/magnayn/Hudson-GIT-plugin/issues#issue/4).
Aug 25
Miraj Hasnaine Tafsir says:
There is no included region feature for GIT. If there are some few regions to be...There is no included region feature for GIT. If there are some few regions to be participated in the build I think its not a good idea to have so many excluded regions to be listed. Included region will be doing better in this case.
about an hour ago
Patrick Renaud says:
I second that. Did you submit a JIRA for this yet?I second that. Did you submit a JIRA for this yet?