Skip to main content
Jenkins User Conference @ SF
Kohsuke Kawaguchi / @kohsukekawa / kk@kohsuke.org
アーキテクト / CloudBees




                 ©2010 CloudBees, Inc. All Rights
                           Reserved
スポンサーにあの会社が




      ©2010 CloudBees, Inc. All Rights   2
                Reserved
©2010 CloudBees, Inc. All Rights   3
          Reserved
Jenkinsをカスタマイズする系の話:
Salesforce
• 昔:モノリシックなシステム
 – 200Kのテスト、延べ3000時間分を6時間で
   並列実行
 – 独自開発したCIサーバ
• 今:モジュール化に伴いモジュール別に
  Jenkinsを立てる方向へ
 – うまくいけば独自開発のCIサーバを捨てら
   れるかも?
 – Jenkinsのインストールを自動化した

         ©2010 CloudBees, Inc. All Rights   4
                   Reserved
こんな感じで質問に答えると…




      ©2010 CloudBees, Inc. All Rights   5
                Reserved
こんな感じで自分のJenkinsが




        ©2010 CloudBees, Inc. All Rights   6
                  Reserved
Jenkinsをカスタマイズする系の話:
NetFlix
• 社内共通化
 – Ant+Ivyベースの共通ビルドツールを開発
 – ビルドがRPM化
 – RPMを集めてAMIを作る「bakery」
 – AMIのグループをデプロイする「asgard」
• Groovy スクリプトを活用
• 独自プラグインを書いてOSS化
 – Job DSL プラグイン
 – Dyna slave プラグイン

           ©2010 CloudBees, Inc. All Rights   7
                     Reserved
Jenkinsをカスタマイズする系の話:
Intel
• 大規模インスタンスの管理
 – 4000人の開発者
 – 50000ビルド/日
• 継承と包含をやるプラグインを書いた
 – 継承:基底ジョブに穴をあけて派生ジョブ
   で埋める
 – 包含:ビルダの設定などを外部化して参照
• オープンソース化されるらしい

           ©2010 CloudBees, Inc. All Rights   8
                     Reserved
Jenkinsをカスタマイズする系の話:
Cisco
• 社内でJenkins as a Serviceを展開(過去
  形)
• コミットワークフローの自動化
• Jenkinsにワークフローエンジンをつけた




           ©2010 CloudBees, Inc. All Rights   9
                     Reserved
プラットフォームとしてのJenkins

 プラグインを組み合わせてやりたい事を
 実現

 プラグインを書いてやりたい事を実現


 Jenkins上に新たなサブシステムを載せて
 やりたい事を実現



        ©2010 CloudBees, Inc. All Rights   10
                  Reserved
面白いアイディア
• 変更されたファイルから実行するテスト
  を割り出す
 – コードカバレッジを利用


• Seleniumスクリーンショットをピクセル
  比較
 – アルゴリズムには工夫の余地がありそう



        ©2010 CloudBees, Inc. All Rights   11
                  Reserved
プラグイン開発トーク
• 2つも
• しかも多くの参加者
• 共通テーマ
 – ドキュメントが少ない
• 何とかしたい




           ©2010 CloudBees, Inc. All Rights   12
                     Reserved
余興




     ©2010 CloudBees, Inc. All Rights   13
               Reserved
余興




     ©2010 CloudBees, Inc. All Rights   14
               Reserved
来年はぜひこれも…




      ©2010 CloudBees, Inc. All Rights   15
                Reserved
資料など
• スライド
 – http://bit.ly/THAqi5




                 ©2010 CloudBees, Inc. All Rights   16
                           Reserved
Jenkowプラグインの紹介
Kohsuke Kawaguchi / @kohsukekawa / kk@kohsuke.org
アーキテクト / CloudBees




                 ©2010 CloudBees, Inc. All Rights
                           Reserved
問題提起
• ジョブ同士の連携
• 複数のジョブの実行にロジックを追加す
  る
 – ボトムアップ方式が現行の主流
 – 全体の見通しが悪い


• 専門のワークフロー言語をつかったら?
 – そこでBPMN 2.0
 – OMG標準
           ©2010 CloudBees, Inc. All Rights   18
                     Reserved
ワークフローの例
             • 開始・終了

             • ちょっとしたプログラ
               ム

             • 生身の人間の作業

             • Jenkinsのジョブを実
               行
      ©2010 CloudBees, Inc. All Rights   19
                Reserved
ワークフローの例
• 並列分岐と合流




        ©2010 CloudBees, Inc. All Rights   20
                  Reserved
ワークフローの例
• 条件分岐と合流




        ©2010 CloudBees, Inc. All Rights   21
                  Reserved
もっと難しい例
• イベントによる分岐




       ©2010 CloudBees, Inc. All Rights   22
                 Reserved
もっと難しい例
• サブルーチン




           ©2010 CloudBees, Inc. All Rights   23
                     Reserved
Jenkinsでの使用例
• リリースワークフロー




         ©2010 CloudBees, Inc. All Rights   24
                   Reserved
BPMNの利点
• 標準化
• 人間を含む作業の記述
• グラフィカル
 – なのに曖昧でない
• ワークフロー編集ツールの存在




          ©2010 CloudBees, Inc. All Rights   25
                    Reserved
モデル
                                               Activiti Explorer


 Jenkins

     Activiti Engine                                DB
                                                                   省略化

                                               Eclipse
   Gitサーバ       ワークフ                                      ワークフ
                ロー定義                                      ロー定義




                       ©2010 CloudBees, Inc. All Rights              26
                                 Reserved
デモ




     ©2010 CloudBees, Inc. All Rights
               Reserved
デモのまとめ
• GUIエディタによる編集
• Gitリポジトリによるワークフロー管理
  – 複数のサーバでワークフローを共有


• http://bit.ly/QQjYqY




                ©2010 CloudBees, Inc. All Rights   28
                          Reserved