目的
まっさらなUbuntu16.04でJenkinsの新しいUIのBlue Oceanプラグインを動かしてみます。
Blue Ocean: https://jenkins.io/projects/blueocean/
依存関係のインストール
$ sudo apt-get install git openjdk-8-jdk-headless maven
プラグインのビルドでjavadocコマンドが必要になるためjdkをインストールしています。
また、Jenkins本体はBlue Oceanプラグインをビルドするとダウンロードされるため不要です。
githubからBlue Oceanプラグインをclone
適当なディレクトリにcloneします。
この時のリビジョンは 8a5daac552b27c026f087e410212db6a843bd920 でした。
$ git clone https://github.com/jenkinsci/blueocean-plugin
ビルド
README.mdに手順が書いてあります。
$ cd blueocean-plugin
$ mvn clean install
現状、Windowsだとテストでコケるらしいのでその場合はスキップしましょう。
$ mvn clean install -DskipTests
起動
ポート8080でjenkinsが立ち上がります。
$ mvn -f blueocean-plugin/pom.xml hpi:run
途中、標準出力にjenkinsの初回セットアップ用のキー が出力されるのでメモしておきましょう。
$ mvn -f blueocean-plugin/pom.xml hpi:run
〜省略〜
*************************************************************
*************************************************************
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <-こいつが初回セットアップキー
This may also be found at: /home/vagrant/workspace/github.com/jenkinsci/blueocean-plugin/blueocean-plugin/work/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************
〜省略〜
アクセスしてみる
初回アクセス時は
http://localhost:8080/jenkins/ にアクセスして初回セットアップキーやデフォルトプラグイン、パスワードの設定をしておきましょう。
そのあとにhttp://localhost:8080/jenkins/blue にアクセスするとBlue Ocean UIが使えます。
が、このリビジョンではBlue Ocean UIで新しいパイプラインを作ろうとするとエラーになったので、いつものJenkinsのUIでパイプラインを作ってからBlue Ocean UIを使いましょう。
とりあえずBlueOceanのトップ画面を表示できたのでここまで。
ハマったところ
Vagrantを使ってVM上で実行していたのですが、VMのメモリが少ない(512MB)と$ mvn clean install
で失敗します。
$ mvn clean install
〜省略〜
[INFO] make: Entering directory '/home/vagrant/workspace/github.com/jenkinsci/blueocean-plugin/blueocean-web/node_modules/bufferutil/build'
[INFO] CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
[INFO] SOLINK_MODULE(target) Release/obj.target/bufferutil.node
[ERROR] printf: write error: Broken pipe
[ERROR] make: *** [Release/bufferutil.node] Error 1
[ERROR] make: write error: stdout
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Blue Ocean UI Parent ............................... SUCCESS [15:23 min]
[INFO] BlueOcean :: Commons API ........................... SUCCESS [01:22 min]
[INFO] BlueOcean :: Web module ............................ FAILURE [04:11 min]
[INFO] BlueOcean :: Rest module ........................... SKIPPED
[INFO] BlueOcean :: Dashboard ............................. SKIPPED
[INFO] BlueOcean :: REST API implementation ............... SKIPPED
[INFO] (Alpha) BlueOcean :: Aggregator .................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26:06 min
[INFO] Finished at: 2016-06-22T23:57:49+09:00
[INFO] Final Memory: 52M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (npm install) on project blueocean-web: Failed to run task: 'npm install' failed. (error code 137) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :blueocean-web
ログにはnpm installで失敗していると出ていますが、VMのメモリを2GBにして$ mvn clean install
を実行するとビルドが成功しました
メモリが少ない環境でビルドが失敗する場合はメモリを増やしてみましょう