Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Hubot事例
Search
ryonext
January 21, 2015
Technology
1.7k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hubot事例
弊社のHubotとSlack連携の活用事例です。
ryonext
January 21, 2015
More Decks by ryonext
See All by ryonext
AWS Lambda の Ruby 対応
ryonext
0
280
TwitterのList編集しやすいやつ作った
ryonext
0
1.8k
validationについて
ryonext
1
860
AWS Lambda と API GatewayでRails使わずに済んだ話
ryonext
8
4.4k
capistrano-bundle_rsync使ったらオートスケールが高速化した話
ryonext
8
2.6k
PumaとUnicornで最近自分が理解したこと
ryonext
13
9.6k
Redisでバッチ処理を冗長化しつつ排他制御
ryonext
0
2.2k
CircleCIとwercker
ryonext
3
1.3k
rubykaigi 3day interactive white board
ryonext
2
410
Other Decks in Technology
See All in Technology
When Does a Local Qwen Start to Break
morshoto
0
200
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
1
220
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/6 - 2026/8
oracle4engineer
PRO
0
150
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
120
synctest時代のhttptest Go 1.27で変わるHTTPサーバテストの裏側 / go conference2026 synctest and httptest
budougumi0617
1
2.6k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
390
AIで仕事のやり方を変える
matsu7874
3
1k
こんなアーキテクチャ図は嫌だ BEYOND THE TIME: 半年後の自分へ贈る15のメッセージ / 15 of Anti-pattern in AWS Architecture Diagrams
naospon
3
310
Tab5をRubyで動くパソコンにする
kishima
2
320
ASTを使って影響範囲を特定する
nealle
0
150
AIで実装は速くなった。なのにプロダクトは速くならない。職能の壁を越えて価値のフローを設計する
nwiizo
8
7.8k
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Tell your own story through comics
letsgokoyo
1
1.1k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Writing Fast Ruby
sferik
630
63k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
WCS-LA-2024
lcolladotor
0
820
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
New Earth Scene 8
popppiees
3
2.5k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
510
Transcript
ฐࣾͷHubotࣄྫ
ࣗݾհ Twitter ID: ryonext Unicon ͱ͍͏ձࣾͰRailsॻ͍ͯ·͢ɻ PS4ങ͍·ͨ͠ 2014ՆΠϕΫϦΞ·Ͱ͙ͬͨΒ͍ͷఏಜͩ ͚Ͳ͖ͬͺΓΊͨͷͰ؋͜ΕΞχϝݟͯ·ͤΜ
Hubotࣄྫ
develop ͔Β master ͷ pull request Λ࡞Δ ඞཁͳαʔϏε Circle CI
ͪΖΜ J但 Ͱ͍͚Δ masterʹϚʔδ͞ΕͨΒ ͦͷ··ຊ൪σϓϩ Π·ͰΔΑ͏ʹͯ͠Δલఏ
σϓϩΠ͍ͨ͠ͱ͖ʹ develop => master ͷ pull req Λ࡞Δͱ͍͏ϧʔνϯϫʔΫ͕ͳ͘ͳ Γੜ࢈ੑͷ্ʹͭͳ͕Δ
pull req ҰཡΛग़͢ hubot show org-pulls ͱ͍͏ίϚϯυ ͜ΕΛͬͯΔ hubot-scripts/github-pulls.coffee at
master · github/hubot-scripts https:/ /github.com/github/ hubot-scripts/blob/master/src/scripts/github- pulls.coffee ࠓ্͕͍ͬͯΔpull requestΛશ෦ग़͢ ޙड़ͷ cron ͱΈ߹Θͤͯ͏͖
ΤϯδχΞ͕ࣗൃతʹpull requestΛݟʹߦ͘ඞཁ͕ͳ͘ͳΓɺ͔͠ཹ͍ͯ͠Δpull request Λݟ͚ͭΔ͜ͱՄೳʹͳΓੜ࢈ੑͷ্ʹͭͳ͕Δ
cron ఆظతʹಛఆͷൃݴΛͤ͞Δ ͜ΕͬͯΔ ncb000gt/node-cron https:/ / github.com/ncb000gt/node-cron ձٞͷϦϚΠϯυΛͨ͠Γɺલड़ͷpull req ҰཡΛݺͼग़ͨ͠Γɺ͍ํࣗ༝ࣗࡏ
ఆظతʹඞཁͳॲཧΛࣗಈ࣮ߦͯ͘͠ΕΔ͜ͱʹΑΓੜ࢈ੑͷ্ʹͭͳ͕Δ
cronࣄྫ1 pull requestͷ௨ ຖܾ·ͬͨ࣌ؒʹͳͬͨΒ hubot show org-pulls Λ࣮ߦ͠ɺpull request ҰཡΛ
ग़͢ ຖܾ·ͬͨ࣌ؒʹ͍ͬͯΔpull requestΛදࣔ͢Δ͜ͱʹΑΓɺϨϏϡʔ͕ଅਐ͞Εੜ࢈ੑͷ ্ʹͭͳ͕Δ
cronࣄྫ2 ேձ&༦ձ + Google Hangouts URLͷ௨ ܾ·ͬͨ࣌ؒʹேձ/༦ձͷ௨ͱɺϦϞʔτ ۈऀ༻ʹGoogle HangoutsͷURLΛߘ
͢Δ͜ͱʹΑΓεϜʔζͳձٞͷ։͕࢝Ͱ͖Δ
ேձʗ༦ձʹΕΔ͜ͱ͕ͳ͘ͳΓɺHangoutsͷURLΛ୳͢ख͕ؒল͚ͯੜ࢈ੑͷ্ʹͭͳ͕Δ
cronࣄྫ 3 9࣌ʹͳͬͨΒࠓ1ؤுΔܾҙΛࣔ͢ը૾ ΛషΔ ࠓҰؤுΕͦ͏ͳը૾ΛݟΔ͜ͱʹΑΓੜ࢈ੑ্ʹͭͳ͕Δ ͨͩ͠ϑϨοΫε͔ͩΒ9͔࣌Βಇ͍͍ͯΔਓ͕গͳ͍
cronࣄྫ3 ͓ͭͷ࣌ؒΛ௨͢Δ 15࣌Λ௨͢Δ͜ͱͰɺΤϯδχΞʹิڅΛଅ͠ɺੜ࢈ੑͷ্ʹͭͳ͕Δ
cronࣄྫ4 ਐḿͷ֬ೝ ϥϯνΛ৯ͯɺ͓ͭΛ৯ͯɺੜ࢈ੑ͕ۃݶ·Ͱߴ·ͬͨΤϯδχΞ͕ͦͷྗΛ༨͢͜ͱແ͘ൃش͠ ͨ͋ͨΓͰͦͷՌΛ֬ೝ͢Δ͜ͱͰϞνϕʔγϣϯ͕Ξοϓ͠ɺੜ࢈ੑͷ্ʹͭͳ͕Δ
cronࣄྫ5 ՖۚΛ௨͢Δ ͨ͠ͳΊΔ ༵ۚͷָ͠͞Λ௨͢ΔͱͱʹɺؾΛҾ͖కΊΔ͜ͱ͕Ͱ͖ੜ࢈ੑͷ্ʹͭͳ͕Δ
͔͜͜Βৄࡉฤ
શମߏ GitHubͷνʔϜΞΧϯτ͕2ͭ͋ΔͨΊɺऔ ಘ༻ͷhubot͕2ମ Cron༻ͷhubot͕1ମ mention༻ʹslackbotΛ׆༻
શମߏɺϦϙδτϦͱ ಈ࡞ڥฤ GitHubcron༻ͷhubotͰ1ϦϙδτϦɺͦ ΕҎ֎ͷhubotͰ1ϦϙδτϦ Herokuʹcron༻Ͱ1, ͦΕҎ֎༻Ͱ2ͭͬ ͯɺڥมͰΞΫηε͢ΔGitHubΛ͍ ͚͍ͯΔ
CronҎ֎༻ͷڥม
Cron༻ͷڥม
develop͔Βmasterͷ pull req ͜Μͳײ͡ͷίʔυ 18 module.exports = (robot) -> 19
github = require("githubot")(robot) 20 robot.respond /deploy ?(.+)/i, (msg) -> 21 repo = msg.match[1] 22 url_api_base = "https://api.github.com" 23 data = { 24 "title": "deploy", 25 "head": "develop", 26 "base": "master" 27 } 28 ghOrg = process.env.HUBOT_GITHUB_ORG 29 url = "#{url_api_base}/repos/#{ghOrg}/#{repo}/pulls" 30 github.post url, data, (response) -> 31 msg.send "ຊ൪ʹσϓϩΠ͢ΔϓϧϦΫΤετΛ࡞ͨ͠Αʂ֬ೝͯ͠Ϛʔδͯ͠Ͷʂ" 32 msg.send response.html_url https:/ /gist.github.com/ryonext/2906f7bd9c865c2d8f1b
pull reqҰཡΛग़͢ https:/ /github.com/github/hubot- scripts/blob/master/src/scripts/ github-pulls.coffee
cron Hubotͷslack adapter Ͱ ఆظతʹൃݴ ͤ͞Δ͜ͱͰ͖Δ͕ɺbotͷൃݴʹରͯ͠bot ʹԠͤ͞Δ͜ͱͰ͖ͳ͍ʢॏཁʣ ͕ͨͬͯ͠ɺxmppΛͬͯൃݴͤ͞Δඞཁ͕ ͋Δ
xmpp xmpp Λ͏߹ɺhubot ͷslack adapterΛ͏߹ͱҧ͍ɺxmppͰૢ࡞͢ ΔͨΊͷslack accountΛ࡞͓ͬͯ͘ඞཁ͕ ͋Δ
Πϝʔδ slack adapter xmpp adapter slack account
xmpp͏߹ͷઃఆ ʢslackଆʣ
hubot x xmpp x slack
None
None
xmpp͏߹ͷઃఆ ʢhubotଆʣ ‘hubot-slack’ͷΘΓʹ’hubot-xmpp’Λ npm install͢Δ heroku ʹ্͛Δ߹ɺίϚϯυΛ `web: bin/hubot --adapter
xmpp -n {bot໊}` ʹ͢Δ
xmppิ xmppͰൃݴͨ͠༰mentionʹͳΒͳ͍ ʢॏཁʣ ͔ͤͬ͘ϨϏϡʔ௨ͯ͠ؾ͔ͮΕͳ͍ slackbot࿈ܞͤ͞ΔɻcronͰͷൃݴʹର͠ ͯslackbotʹԠͤ͞Δ
͜͏ͬͯ
͜͏ͳΔͷͰpush௨͕ དྷΔ
͓͠·͍ ࣭͋Εؾܰʹฉ͍͍ͯͩ͘͞ɻ HipChatͩͱbotؒ࿈ܞͬͱָͦ͏ͳؾ͕͠ ͯΔ