Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ChatBotの重いタスクをCircleCIに持っていってみた / How to move h...
Search
mackee
January 16, 2020
Programming
1
4.2k
ChatBotの重いタスクをCircleCIに持っていってみた / How to move heavy tasks on ChatBot to CircleCI
CircleCI ユーザーコミュニティミートアップ#8
https://circleci.connpass.com/event/157469/
mackee
January 16, 2020
Tweet
Share
More Decks by mackee
See All by mackee
ワンバイナリWebサービスのススメ
mackee
10
7.8k
tanukistack ライブコーディング / tanukistack live-coding
mackee
0
110
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
690
perl for shell, awk and sed programmers
mackee
2
2.3k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
650
database/sqlでNullを扱う歴史とsql.Null[T]の登場 / sql.Null[T] history
mackee
0
540
マイクロサービス化を利用した Goへの移行事例
mackee
0
670
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
4.6k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
1.9k
Other Decks in Programming
See All in Programming
ニーリーにおけるプロダクトエンジニア
nealle
0
890
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
1k
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
240
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
210
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
970
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
670
PicoRuby on Rails
makicamel
2
140
Goで作る、開発・CI環境
sin392
0
260
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
97
34k
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
5
8.2k
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
180
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
1
450
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
43
7.6k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
A designer walks into a library…
pauljervisheath
207
24k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Typedesign – Prime Four
hannesfritz
42
2.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
For a Future-Friendly Web
brad_frost
179
9.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
Transcript
ChatBotͷॏ͍λεΫΛ CircleCIʹ͍࣋ͬͯͬͯΈͨ CircleCIϢʔβʔίϛϡχςΟϛʔ τΞοϓ#8 2020-01-16 ໘ന๏ਓΧϠοΫ @mackee_w 1
୭ • macopy, twitter: @mackee_w, GitHub: @mackee • ໘ന๏ਓΧϠοΫ •
αʔόαΠυΤϯδχΞ 2
͓͍ͨ͜͠ͱ CircleCIͷδϣϒ Ͳ͔͜ΒτϦΨʔ͢Δ͔ 3
ҰൠతʹϦϙδτϦͷpush 4
ChatBot͔ΒδϣϒΛΩοΫ͍ͨ͠ 5
ͳͥ => pushʹඥ͔ͳ͍λεΫ͕͋Δ • PullRequestͷϨϏϡʔΞαΠϯΨνϟ • Google Spreadsheet͔ΒCSVΛग़ྗͯ͠pushͯ͠ Pull Requestʹ͢Δ
• ςετ͕ΊͪΌॏ͍ͷͰҙͷλΠϛϯάͰςετΛ τϦΨʔ͍ͨ͠ 6
ैདྷChatBot͕͍ࣗͬͯͨ • BotPerlͰॻ͔ΕͨSlack RTMΛ͠ΌΔ܅ • ΠϕϯτۦಈͰಈ͘ϑϨʔϜϫʔΫ্ʹ͍ͬͯΔ • ίϚϯυ͕དྷΔͱλεΫ͕ॻ͔ΕͨεΫϦϓτΛىಈ ͢Δ •
͏͔ͬΓϒϩοΩϯάIOͳίʔυΛॻ͘ͱɺδϣϒ ΛฒߦͰड͚ΒΕͳ͘ͳͬͨΓɺ٧·ͬͯࢮΜͩ 7
ChatBot͕ͦͷ··λεΫΛ࣮ߦ͢Δࡍͷ • ॏ͍λεΫ͕͋Δͱ٧·Δ • ผϓϩηεʹͨ͠Βσόοά͕ҟৗʹ͘͠ͳͬͨ • εέʔϧ͠ͳ͍ SPOF • ChatBot͕ॅΉαʔόΛۀ࣌ؒதʹམͱͤͳ͍
• ϒϥϯν͝ͱͷλεΫͷඇޓͷରԠ͕ΊΜͲ͍͘͞ • chatbotͷίʔυͱϒϥϯνͷதͷίʔυͷඇޓ 8
CircleCIʹ͍࣋ͬͯ͘ͱ... • λεΫ͕ॏ͍߹Ωϡʔ͕٧·Δ͕ΩϡʔʹೖΔ • ແࢹ͞Εͳ͍ • εέʔϧ => ͓ۚΛ͑͢Δ •
ฐࣾPerformance PlanΛܖ͓ͯ͠Γ·͢ • ϒϥϯν͝ͱͷλεΫඇޓੑ • ϒϥϯνͷεΫϦϓτΛ࣮ߦ͢Δ͔Βղܾ 9
Γ͍ͨ͜ͱΛ·ͱΊΔͱ ҙͷλεΫΛ CircleCIͰ ͖ͳͱ͖ʹ࣮ߦ͍ͨ͠ʂ 10
͜͜ʹAPI͕͋Γ·͢ 11
͕ɺ͔͠͠ɺv1.1 API... • CircleCI 2.1ʹະରԠ • workflowະରԠ • ͦͦ3/1ʹ͑ͳ͘ͳΔͦ͏Ͱ͢ •
https://circleci.com/blog/a-deprecation-notice- on-job-triggering-with-api-v1-1/ 12
͜͜ʹv2 API͕͋Γ·͢ 13
v2 APIͷಛ • pipeline parametersͷಋೖ • 2.1 config͔Βಋೖ͞Εͨparametersͷworkflow ʹద༻Ͱ͖Δ൛ •
workflowͰjobΛىಈ͢Δͱ͖ͷparametersʹ ͑ͨΓɺpipeline parametersͷঢ়ଶΛݟͯ workflowΛىಈ͢Δ͔ܾΊΒΕΔ 14
config.ymlൈਮ workflows: version: 2.1 test: when: << pipeline.parameters.do_test >> jobs:
- app_test: filters: branches: only: - /^feature\/.*/ run_task: when: << pipeline.parameters.do_daiku >> jobs: - do_task: taskname: << pipeline.parameters.daiku_task >> 15
APIΛ͛ͯΈ·͠ΐ͏ my $base_uri = "https://circleci.com/api/v2/project/gh/kayac/project_name/pipeline"; my $circleci_token = $ENV{CIRCLECI_TOKEN}; my
$body = encode_json({ branch => $branch, parameters => { do_test => bool(0), do_daiku => bool(1), daiku_task => escape_task_name($job, @args), }, }); http_post "${base_uri}?circle-token=${circleci_token}", $body, headers => { "content-type" => "application/json" }, $cb; 16
·ͱΊ • ChatBot͕ͬͯͨॏͦ͏ͳλεΫΛCircleCIʹ࣋ͬ ͍ͯͬͨΑ • ͦͦChatBot͕ΔͷʹෆదͳλεΫͩͬͨ Ͷ • CircleCI v2Λ͑APIͰworkflowΛenqueueͰ͖Δ
Α 17
·ͱΊ • ϒϩάͰΞφϯε͕͋ͬͨΑ https://circleci.com/ blog/introducing-circleci-api-v2/ • ͬͱৄ͍ͪ͜͠Β https:// techblog.kayac.com/circleci-api-v2 18