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.1k
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
tanukistack ライブコーディング / tanukistack live-coding
mackee
0
73
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
400
perl for shell, awk and sed programmers
mackee
2
1.9k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
330
database/sqlでNullを扱う歴史とsql.Null[T]の登場 / sql.Null[T] history
mackee
0
250
マイクロサービス化を利用した Goへの移行事例
mackee
0
380
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
4k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
1.9k
TinyGoで使えるORM sqllaの 紹介とTinyGoで使えるようにするための工夫
mackee
0
1.4k
Other Decks in Programming
See All in Programming
Denoでフロントエンド開発 2025年春版 / Frontend Development with Deno (Spring 2025)
petamoriken
1
1.3k
Coding Experience Cpp vs Csharp - meetup app osaka@9
harukasao
0
120
本当だってば!俺もTRICK 2022に入賞してたんだってば!
jinroq
0
260
コンテナでLambdaをデプロイするときに知っておきたかったこと
_takahash
0
150
OpenTelemetryを活用したObservability入門 / Introduction to Observability with OpenTelemetry
seike460
PRO
1
350
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
1k
Windows版PHPのビルド手順とPHP 8.4における変更点
matsuo_atsushi
0
370
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
220
NestJSのコードからOpenAPIを自動生成する際の最適解を探す
astatsuya
0
190
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
240
Day0 初心者向けワークショップ実践!ソフトウェアテストの第一歩
satohiroyuki
0
440
Kubernetesで実現できるPlatform Engineering の現在地
nwiizo
2
1.7k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
8
700
Automating Front-end Workflow
addyosmani
1369
200k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
22
2.6k
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
7
620
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
GraphQLとの向き合い方2022年版
quramy
45
14k
Mobile First: as difficult as doing things right
swwweet
223
9.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
25k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Become a Pro
speakerdeck
PRO
27
5.2k
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