|
This plugin allows use of GIT as a build SCM. Git 1.3.3 or newer is required.
Plugin Information
Download latest version 0.7.3Bugs
Note for contributors: Please read SVN_USERS_PLEASE_READ_MEproperly before checking out the sources. Those instructions are useful if you wish to use Git to contribute and request Nigel Magnay to pull your changes. 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)
ChangelogVersion 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 (12)
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
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
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
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
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.
Jan 06
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
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
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
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.
Jan 11
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
yesterday at 12:51 PM
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: