wercker_build_triggerについて
Wercker のビルドを外部から手軽に実行するためのツールです
モチベーション
僕は下記のように週1回Travis CIで定期ビルドを実行しています
WerckerでCI回してるリポジトリでも定期ビルドをやりたかったのですが、WerckerではTravis CIのCron jobsのような機能がなかったのでcrontabから実行しやすくするためにツールを作りました。
使い方
golang製なので https://github.com/sue445/wercker_build_trigger/releases からバイナリを落としてきて適当な場所に置いてください。
設定ファイルはこんな感じ
pipelines: - application_path: "wercker/docs" pipeline_name: "build" branch: "master" - application_path: "sue445/wercker_build_trigger"
application_pathは必須。pipeline_name
とbranch
は省略可。pipeline_name
省略時はbuild
が、branch
省略時はmaster
が使われます
crontabにこんな感じに書いておけば毎週日曜の3:00に実行されます。
0 3 * * 0 /path/to/wercker_build_trigger --config /path/to/wercker_build_trigger.yml --token xxxxxxx
tokenは https://app.wercker.com/profile/tokens で生成したやつを貼り付けてください。
導入事例
実際に使ってる設定ファイル。
pipelines: - application_path: "sue445/itamae-plugin-recipe-omori_gohan" - application_path: "sue445/itamae-plugin-recipe-tmux" - application_path: "sue445/itamae-plugin-recipe-tig" - application_path: "sue445/itamae-plugin-recipe-git_now" - application_path: "sue445/itamae-plugin-resource-encrypted_remote_file" - application_path: "sue445/itamae-plugin-recipe-consul" - application_path: "sue445/capistrano-itamae" - application_path: "sue445/wercker_build_trigger"
wercker_build_trigger自身の定期ビルドもwercker_build_triggerで行っています。(ややこしい)
実行結果
[application_path:sue445/itamae-plugin-recipe-omori_gohan][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54714816100010bd46f [application_path:sue445/itamae-plugin-recipe-tmux][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54814816100010bd477 [application_path:sue445/itamae-plugin-recipe-tig][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a5492535040001c453c2 [application_path:sue445/itamae-plugin-recipe-git_now][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54a8e888f0001b7de36 [application_path:sue445/itamae-plugin-resource-encrypted_remote_file][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54c8e888f0001b7de3e [application_path:sue445/itamae-plugin-recipe-consul][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54d14816100010bd47f [application_path:sue445/capistrano-itamae][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54e8e888f0001b7de46 [application_path:sue445/wercker_build_trigger][pipeline_name:build][branch:master] Triggered pipeline: https://app.wercker.com/api/v3/runs/59d9a54f2535040001c453ca
ビルド結果はSlackに流すようにしてるのでこんな風に通知されます