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
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
150
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
250
Podは生きているのにGoだけが落ちる:GOGCとGOMEMLIMITで追うInvisible OOM Killの謎
tkc66buzz
1
500
作り直せるコードは迅速に 作り直せないDBは慎重に - AI時代のプロダクトエンジニアが「判断の不可逆性」で開発速度を変える話
kinosuke01
0
300
深夜のクラウド懺悔室 1:29:300 or 1:0:0
kazzpapa3
1
230
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
250
全員がプロダクトへ向き合う組織を持続成長させるために——組織づくりのフライホイールと4象限 / The Flywheel Model and Four Quadrants for Organizational Design
hiro_torii
4
960
2026_devsumi_ozono.pdf
o3
2
310
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
1
210
生成AIのテナント制御とシャドーMCP対策 | AIを"止めずに"、情報を守る
yukun
0
140
Tab5をRubyで動くパソコンにする
kishima
2
300
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
600
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
590
Chasing Engaging Ingredients in Design
codingconduct
0
300
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Technical Leadership for Architectural Decision Making
baasie
3
560
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
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ؒ࿈ܞͬͱָͦ͏ͳؾ͕͠ ͯΔ