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
8k
tanukistack ライブコーディング / tanukistack live-coding
mackee
0
120
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
830
perl for shell, awk and sed programmers
mackee
2
2.4k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
800
database/sqlでNullを扱う歴史とsql.Null[T]の登場 / sql.Null[T] history
mackee
0
690
マイクロサービス化を利用した Goへの移行事例
mackee
0
820
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
5k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
2k
Other Decks in Programming
See All in Programming
コーディングエージェント時代のNeovim
key60228
1
110
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
1
2.2k
UbieのAIパートナーを支えるコンテキストエンジニアリング実践
syucream
2
730
RDoc meets YARD
okuramasafumi
3
140
Understanding Ruby Grammar Through Conflicts
yui_knk
1
140
ゲームの物理
fadis
5
1.5k
令和最新版手のひらコンピュータ
koba789
14
8k
A Gopher's Guide to Vibe Coding
danicat
0
180
decksh - a little language for decks
ajstarks
4
21k
Langfuseと歩む生成AI活用推進
licux
3
300
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
160
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
3
1.3k
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
25
1.8k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
The Art of Programming - Codeland 2020
erikaheidi
55
13k
Agile that works and the tools we love
rasmusluckow
329
21k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
The Cult of Friendly URLs
andyhume
79
6.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Bash Introduction
62gerente
614
210k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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