LoginSignup
13
13

More than 5 years have passed since last update.

シンプルなパイプラインツールwalterを少しだけ試してみた

Last updated at Posted at 2014-11-18

walterってツールがあるよと聞いたので、どんな感じかと触ってみました。

シンプルなビルドパイプラインツールwalterをリリースしました | Advanced Technology Lab

walterはGo言語で作られているので色々なプラットフォームで動くし、一旦ビルドしてしまえば単体で動くので楽ですね。

  • 設定はpipeline.yml
  • notificationがコンフィグに内包される
  • パイプライン中のタスクは順に実行、それぞれ事後処理を並行に実行

walterのバイナリをjenkinsユーザ用に設置

とりあえずビルドして、そのへんのJenkinsサーバに設置してみました。

ビルド済みのバイナリがちゃんとありました..

https://github.com/walter-cd/walter/releases

jenkinsユーザから~/bin/walterで叩けるように設置。

ln -s PATH_TO_WALTER_BUILD_DIR/bin/walter $HOME/bin/

動きましたね。

$ id
uid=107(jenkins) gid=65534(nogroup) groups=65534(nogroup)

$ ~/bin/walter -v
Walter version v0.1.0-12-gf55bda5

適当なパイプラインを実行してみる

とりあえずstepを順に実行しつつ、平行にrun_afterしてみます。
設定ファイルのpipeline.ymlをこんな感じで用意しました。

pipeline.yml
---
messenger: 
   type: fake

pipeline:
  # step 1
  - stage_name: Notify the beggining of process pipeline
    command: echo "build pipeline is started"
    message: true
    run_after:
      -  stage_name: concurrent task
         command: echo "hogehoge 1"
      -  stage_name: concurrent task
         command: echo "hogehoge 2"
      -  stage_name: concurrent task
         command: echo "hogehoge 3"
      -  stage_name: concurrent task
         command: echo "hogehoge 4"
      -  stage_name: concurrent task
         command: echo "hogehoge 5"
  - stage_name: Notify the finish of process pipeline
    message: true
    command: echo "build pipeline is finished"

で。実行と。

$ ~/bin/walter 
17:14:13  INFO Found messenger block
17:14:13  INFO type of reporter is fake
17:14:13  INFO running Walter
17:14:13  INFO geting starting to run pipeline process...
17:14:13  INFO [command] exec: echo "build pipeline is started"
17:14:13  INFO [command] output: build pipeline is started
17:14:13  INFO [command] exec: echo "hogehoge 1"
17:14:13  INFO [command] exec: echo "hogehoge 2"
17:14:13  INFO [command] exec: echo "hogehoge 3"
17:14:13  INFO [command] exec: echo "hogehoge 4"
17:14:13  INFO [command] exec: echo "hogehoge 5"
17:14:13  INFO [command] output: hogehoge 3    # 順番がバラバラ
17:14:13  INFO [command] output: hogehoge 1    # 順番がバラバラ
17:14:13  INFO [command] output: hogehoge 2    # 順番がバラバラ
17:14:13  INFO [command] output: hogehoge 4    # 順番がバラバラ
17:14:13  INFO [command] output: hogehoge 5    # 順番がバラバラ
17:14:13  INFO [command] exec: echo "build pipeline is finished"
17:14:13  INFO [command] output: build pipeline is finished
17:14:13  INFO finished to run pipeline process...
17:14:13  INFO succeded to finish Walter

run_afterのところはバッチリ並行してますね。冒頭のブログのサンプルではコードのテストとデプロイ先のサーバ設定を平行に実施していて、なるほどと思いました。

walterどうつかおう

今のところ、設定ファイルに通知とタスクが書けつつ、小さいバイナリで持ち運び可能なことが特徴です。

CIで実行するアレコレの可搬性を考えると、タスクはまずまず共通化もしやすいけども、通知やHookはCIサーバ・サービス側に設定することが多い=> 移住性がイマイチです。

walterではpipeline.ymlさえ作ればCIサービス検討先の各種hookの対応状況とかを気にせず持ち運べるので、walter本体の対応先が増えると嬉しいのかな?
通常のCIサービスでは設定自体の失敗で待ち時間が発生したりしますけど、walterはパイプラインをローカルでも試せる(≒自前CIサーバでもOK)のもポイント高いです。

ただ、messengerの対応先はpacker plugin構想みたいにしないと管理が大変そうですよね。


追記: とりあえず導入してみた。

開発/プレビュー用途のサーバをリスタートしたとき、(基本じゃんじゃんデプロイするので)自動起動にしてなかった開発中Railsアプリを上げるのがcap cap cap で面倒だったのでwalter導入。

並行性を活かしてcap三連装としてみた。

ci/walter/hoge01_after_restart_vm.yml
messenger:
  type: fake

pipeline:
  - stage_name: start myapp
    command: ssh hoge01.example.com id
    message: true
    run_after:
      - stage_name: start puma
        command: cap sandbox puma:start
      - stage_name: start sidekiq
        command: cap sandbox sidekiq:start
      - stage_name: start puma
        command: cap sandbox amqp_worker:start

で、こんな感じで叩けるように。

walter -c ci/walter/hoge01_after_restart_vm.yml

少しだけ楽 & 処理が早くなった。

13
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13