January 1, 2013

JenkinsでGitプロジェクトをビルドしてみる

試しにFuelPHPでやってみます。 とりあえず、Jenkinsでジョブを作成して、Gitからソースをビルドするだけです。尚、Mac OS Xで確認しています。
* 後ほど、Ubuntuでも確認しました。


1. Gitプラグインのインストールと再起動
--
Jenkins > Manage Jenkins > Manage Plugins > Available > "Git Plugin"にチェック > Download now and install after restart > "Restart Jenkins when installation is complete and no jobs are running"にチェック
* 後述の"3. ジョブの設定"で必要になります。
* Ubuntuでは、手動で再起動しました。

2. 新規ジョブ作成
--
Jenkins > New Job > Job nameは"FuelPHP" > "Build a free-style software project"にチェック > OK


3. ジョブの設定(Jenkins > FuelPHP > Configureより)
--
(1) Source Code Managementで"Git"にチェック > Repository URLを"https://github.com/fuel/fuel.git"に。

(2) "Repository browser"近くの"Advanced…" > "Skip internal tag"にチェック
Manage Jenkins > Configure System > Git plugin でGlobal Config user.name ValueとGlobal Config user.email Valueを入力。
* これをしないと、Mac/Ubuntu共に、後述の"Please tell me who you are."エラーが発生しました。
参考: http://stackoverflow.com/questions/11122913/jenkinsgit-tell-me-who-you-are-error-why-does-it-need-to-tag

(3) 画面最下部の"Save"で保存


4. ビルド
--
Jenkins > FuelPHP > Build Now


5. ワークスペースの確認
--
Jenkins > FuelPHP > Workspace


"Please tell me who you are."エラーのログ
ユーザーanonymousが実行
ビルドします。 ワークスペース: /Users/Shared/Jenkins/Home/jobs/FuelPHP/workspace
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/FuelPHP/workspace - hudson.remoting.LocalChannel@11513fd0
Using strategy: Default
Fetching changes from 1 remote Git repository
Fetching upstream changes from https://github.com/fuel/fuel.git
Seen branch in repository origin/1.0/master
Seen branch in repository origin/1.1/master
Seen branch in repository origin/1.2/develop
Seen branch in repository origin/1.2/master
Seen branch in repository origin/1.3/develop
Seen branch in repository origin/1.3/master
Seen branch in repository origin/1.4/develop
Seen branch in repository origin/1.4/master
Seen branch in repository origin/1.5/develop
Seen branch in repository origin/HEAD
Commencing build of Revision 8c69f6781d09ba4447cd529c655137b39eb82af1 (origin/1.0/master)
Checking out Revision 8c69f6781d09ba4447cd529c655137b39eb82af1 (origin/1.0/master)
FATAL: Could not apply tag jenkins-FuelPHP-3
hudson.plugins.git.GitException: Could not apply tag jenkins-FuelPHP-3
 at hudson.plugins.git.GitAPI.tag(GitAPI.java:829)
 at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1270)
 at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1231)
 at hudson.FilePath.act(FilePath.java:852)
 at hudson.FilePath.act(FilePath.java:825)
 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1231)
 at hudson.model.AbstractProject.checkout(AbstractProject.java:1325)
 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
 at hudson.model.Run.execute(Run.java:1543)
 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
 at hudson.model.ResourceController.execute(ResourceController.java:88)
 at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "git tag -a -f -m Jenkins Build #3 jenkins-FuelPHP-3" returned status code 128:
stdout: 
stderr: 
*** 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  <jenkins@macbook.local> not allowed

 at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897)
 at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:858)
 at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:868)
 at hudson.plugins.git.GitAPI.tag(GitAPI.java:827)
 ... 13 more

No comments:

Post a Comment