Hudson の gitプラグインを使ってみた。

hudson git pluginをいれてみた。
チェックアウトまではスムーズで、
Repository urlにローカルのディレクトリを書いたらうまくいったかんじ。

ただ、tagをうつところで、nameとかがないとエラーがでていた。

/var/lib/hudson/.gitconfig

を新たに作って次のように書いてみたがだめだった。

[user]
email=hudson@localhost
name=Hudson

結局workspace下の、.git/configに上の設定を書き足せばよかったようだ。
[core]
も書く必要があったのかな、、、

以下エラー出力

started
Checkout (update)
Fetching upstream changes
[workspace] $ git fetch
[workspace] $ git tag -l hudson-*
[workspace] $ git show-ref -s --tags hudson-monit_manual-2
[workspace] $ git cat-file -p 7ca19453dc345ce712993e63c01bd9c641f7054a
[workspace] $ git branch -a
[workspace] $ git rev-parse master
[workspace] $ git rev-parse origin/HEAD
[workspace] $ git rev-parse origin/master
[workspace] $ git branch -a --contains 5ae535bd1adf3bee823134a8962dddac5ec268e5
[workspace] $ git rev-parse master
[workspace] $ git rev-parse origin/HEAD
[workspace] $ git rev-parse origin/master
Candidate revisions to be built: 
[workspace] $ git rev-parse HEAD
Nothing to do (no unbuilt branches) - rebuilding HEAD Rev 5ae535bd1adf3bee823134a8962dddac5ec268e5 ()
Checking out Rev 5ae535bd1adf3bee823134a8962dddac5ec268e5 ()
[workspace] $ git checkout -f 5ae535bd1adf3bee823134a8962dddac5ec268e5
HEAD is now at 5ae535b... init add
[workspace] $ git tag -l hudson-*
[workspace] $ git show-ref -s --tags hudson-monit_manual-2
[workspace] $ git cat-file -p 7ca19453dc345ce712993e63c01bd9c641f7054a
[workspace] $ git rev-list 5ae535bd1adf3bee823134a8962dddac5ec268e5
[workspace] $ git tag -a -f hudson-monit_manual-5 -m "Hudson Build #5"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident  <hudson@debian
.(none)> not allowed
FATAL: Error in tag
hudson.plugins.git.GitException: Error in tag
	at hudson.plugins.git.GitAPI.launch(GitAPI.java:229)
	at hudson.plugins.git.GitAPI.tag(GitAPI.java:264)
	at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:395)
	at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:356)
	at hudson.FilePath.act(FilePath.java:389)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:356)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:681)
	at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:264)
	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:238)
	at hudson.model.Run.run(Run.java:832)
	at hudson.model.Build.run(Build.java:88)
	at hudson.model.ResourceController.execute(ResourceController.java:70)
	at hudson.model.Executor.run(Executor.java:90)
Caused by: hudson.plugins.git.GitException: Error in tag
	at hudson.plugins.git.GitAPI.launch(GitAPI.java:226)
	... 12 more

追記:コミット後に自動的にジョブを実行するには

.git/hooks/post-commit

/usr/bin/curl http://localhost:8080/hudson/jobs/YOURJOB/build

と、書いておけばよいみたい

参考

Continuous Integration Blueprints: How to Build an Army of Killer Robots With Hudson and Cucumber
http://www.softwarebloat.com/2008/11/19/continuous-integration-blueprints-how-to-build-an-army-of-killer-robots-with-hudson-and-cucumber/