弊社インターンの @odailly_jp さんのお陰でLingrにHubotが設置され、従来のLingr Github Botではできなかったコメントの通知が来るようになった。(IssuesやPRのコメントを拾ってくれるPluginを作ってくれたので。)
odaillyjp/hubot-github-comments-notifier
便利ー!
弊社インターンの @odailly_jp さんのお陰でLingrにHubotが設置され、従来のLingr Github Botではできなかったコメントの通知が来るようになった。(IssuesやPRのコメントを拾ってくれるPluginを作ってくれたので。)
odaillyjp/hubot-github-comments-notifier
便利ー!
今までは@hrysd謹製のcapistrano-lingrを使ってましたがEYCに移ったのでenginyard gemのdeploy hookを使います。
deploy
ディレクトリの下にフック名でrubyファイルを置くとそれが勝手に実行されるようになっています。
APP_ROOT/
deploy/
before_bundle.rb
after_bundle.rb
before_compile_assets.rb
after_compile_assets.rb
before_migrate.rb
after_migrate.rb
before_symlink.rb
after_symlink.rb
before_restart.rb
after_restart.rb
参照: Use Deploy Hooks : Engine Yard Developer Center
通知はいつでもいいのでafter_restart
にしてみました。
# Gemfile:
gem 'lingman', github: 'hrysd/lingman'
# deploy/after_restart.rb
# encoding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'lingman'
Lingman::Updater.update(
"fjord_assistant", # BOT ID
"takoroom", # ROOM ID
"XXXXXXXXXXXXX", # SECRET
"#{app} を #{environment_name} にデプロイしました。"
)
deployスクリプトはPlain old ruby fileなのでrequire 'bundler/setup'
でbundleしたgemにパスを通してもらいます。
Lingrへの通知にはこれまた@hrysdのlingmanを使わせてもらいました。Lingr APIを網羅してないのでまだgemにしたくないようですが、githubから読み込んで使います。
これでイチイチ「怖話、本番環境にデプロイしましたー」とチャットに報告しなくてよくなりました。
jenkinsのlingr-pluginを使おうとして挫折したメモ。ローカルに最小限のjenkinsをセットアップし、echo Hello
するだけのjobを作って試してみました。
lingr appのapp_keyを得る
% irb -rdigest/sha1
>> Digest::SHA1.hexdigest('key' + 'secret')
=> "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Global Lingr SettingsにUserName, Password, AppKey, Roomを設定する。(これRoomにパスワードかかってる場合はどうなるんだろう?)
Build Nowしてみると、
app_keyが無いって言われちゃう。
lingr-pluginをデバッグしてみようと思い、公式reposからcloneしてきてbuildしようと試みる。
% cit clone git://github.com/jenkinsci/lingr-plugin.git
% cd lingr-plugin
% mvn test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.jenkins-ci.plugins:lingr-plugin:hpi:0.2-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for com.cloudbees:maven-license-plugin is missing. @ org.jenkins-ci.plugins:plugin:1.420, /Users/komagata/.m2/repository/org/jenkins-ci/plugins/plugin/1.420/plugin-1.420.pom, line 191, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building lingr-plugin 0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.yoshiori.lingr:lingr-bot:jar:0.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.782s
[INFO] Finished at: Sun Feb 24 20:36:52 JST 2013
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project lingr-plugin: Could not resolve dependencies for project org.jenkins-ci.plugins:lingr-plugin:hpi:0.2-SNAPSHOT: Failure to find org.yoshiori.lingr:lingr-bot:jar:0.1 in http://maven.jenkins-ci.org/content/groups/artifacts/ was cached in the local repository, resolution will not be reattempted until the update interval of maven.jenkins-ci.org has elapsed or updates are forced -> [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/DependencyResolutionException
org.yoshiori.lingrのlingr-botが取れないみたいです。lingr-botの方も自前でbuildして、mvn install:install-fileで入れてみてからbuildしても駄目。(色々足りないエラーが出る)
とりあえずmavenを初めて使った俺のjavaスキルじゃ疲れたので一旦休憩しまーす。
ところでmavenって「めいぶん?」「めいゔぁん?」