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
開発者(個人)のためのJenkins 運用編
Search
Yasuhiroki
November 08, 2017
Technology
0
2.3k
開発者(個人)のためのJenkins 運用編
第11回 Jenkins勉強会 LT
Yasuhiroki
November 08, 2017
Tweet
Share
More Decks by Yasuhiroki
See All by Yasuhiroki
自分に勉強させるには
yasuhiroki
1
430
Android Studio `Command+Shift+A`
yasuhiroki
0
360
シェルスクリプトをサーバーレスで cron したい
yasuhiroki
1
840
rails new コマンド
yasuhiroki
1
780
自動化を習慣化する
yasuhiroki
2
15k
GitHub Actions Parallel Testing
yasuhiroki
1
1.3k
circleci.vim
yasuhiroki
0
1.7k
ベンチャー企業がCircleCIを選んだ理由と活用方法
yasuhiroki
1
810
Rubyの正規表現を調べてみた
yasuhiroki
0
880
Other Decks in Technology
See All in Technology
Evolution on AI Agent and Beyond - AGI への道のりと、シンギュラリティの3つのシナリオ
masayamoriofficial
0
150
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
2
20k
生成AI利用プログラミング:誰でもプログラムが書けると 世の中どうなる?/opencampus202508
okana2ki
0
190
サイボウズフロントエンドの横断活動から考える AI時代にできること
mugi_uno
4
1.4k
モバイルアプリ研修
recruitengineers
PRO
2
110
キャリアを支え組織力を高める「多層型ふりかえり」 / 20250821 Kazuki Mori
shift_evolve
PRO
2
290
R-SCoRe: Revisiting Scene Coordinate Regression for Robust Large-Scale Visual Localization
takmin
0
410
ウォンテッドリーのアラート設計と Datadog 移行での知見
donkomura
0
300
datadog-distribution-of-opentelemetry-collector-intro
tetsuya28
0
240
Product Management Conference -AI時代に進化するPdM-
kojima111
0
210
AIドリブンのソフトウェア開発 - うまいやり方とまずいやり方
okdt
PRO
9
560
LLMエージェント時代に適応した開発フロー
hiragram
1
390
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
73
5k
Raft: Consensus for Rubyists
vanstee
140
7.1k
How to Think Like a Performance Engineer
csswizardry
25
1.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
For a Future-Friendly Web
brad_frost
179
9.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
։ൃऀ(ݸਓ)ͷͨΊͷ Jenkins ӡ༻ฤ @yasuhiroki
@yasuhiroki
https://certificates.cloudbees.com/10203903
։ൃऀ(ݸਓ)ͷͨΊͷJenkins
ࢲͷࢲʹΑΔࢲͷͨΊͷJenkins • ผʹࣗͰͬͯྑ͍Μ͚ͩͲɺ ΘΓʹͬͯ͘ΕΔͳΒॿ͔Δ࡞ۀ • ۀͱͯࣗ͠ಈԽ͢Δ΄ͲͰͳ͍͚Ͳɺ ࣗಈԽͤͣʹ͍ΒΕͳ͔ͬͨ࡞ۀ • ༡ͼ
ͤͳੜ׆ ࠓૉ͔ɺφϕΞπ͔Λڭ͑ͯ͘ΕΔࣥࣄ
ࣥࣄޏ༻ܭը
ࣥࣄ͍ࣺͯ
ඞཁͳ࣌ʹޏ͍ ඞཁͷͳ͍࣌ղޏ͢Δ
Jenkinsͷߏங
ࢲͷͨΊͷJenkins͔ͩΒ ࢲͷ͖ͳΑ͏ʹߏங͢Δ
DockerͰJenkinsΛىಈ͢Δ • Docker • https://hub.docker.com/_/jenkins/ Ͱͳ͘ • https://hub.docker.com/r/jenkinsci/jenkins/ Ͱͳ͘ •
https://hub.docker.com/r/jenkins/jenkins/ ͚ͩͲ • https://store.docker.com/images/jenkins ͋Δ
JenkinsͷߏஙGitHubͰཧ • docker-compose • docker-compose.yml Λ GitHub Ͱཧ
ΧελϚΠζDockerfileͰ • Dockerfile • ࢲͷͨΊͷJenkinsͷॳظߏங • ࣗ༻ͷ Docker ΠϝʔδΛ DockerHub
ʹ push ͯ͠ྑ͍ • ࣗͷࣥࣄ͕ଞॴͰಇ͍ͯࣧౄ͠ͳ͍ਓʹݶΔ • ͋Β͔͡Ί༻ҙ͞Ε͍ͯΔػೳΛ͑ɺ DockerΠϝʔδΛ༻ҙ͠ͳͯ͋͘ΔఔಈతʹߏஙͰ͖Δ
*.override • ެࣜJenkins Docker ͷػೳ • config.xml.override ͳͲͱ༻ҙͨ͠ϑΝΠϧͰɺίϯς φىಈ࣌ʹݩͷϑΝΠϧʹ্ॻ͖͢Δ •
ڧͯ͘χϡʔήʔϜͰ͖Δ
install-plugin.sh • ެࣜJenkins Docker ͷػೳ • Πϯετʔϧ͍ͨ͠ plugin ͷҰཡΛॻ͍ͨϑΝΠϧΛ৯ ΘͤΔͱɺίϯςφىಈ࣌ʹ
ґଘ͢Δ plugin ؚΊͯΠ ϯετʔϧͯ͘͠ΕΔ • όʔδϣϯࢦఆՄೳ
-Djenkins.install.runSetupWizard=false • Jenkinsىಈ࣌ʹ͢JAVA_OPT • ॳճىಈ࣌ʹग़ͯ͘ΔɺΦεεϝϓϥάΠϯͷΠϯετʔ ϧηΩϡϦςΟઃఆͳͲΛεΩοϓͰ͖Δ • ࢲͷࢲʹΑΔࢲͷͨΊͷJenkinsʹෆཁͳͷͰઃఆ͢Δ
Jenkinsδϣϒͷཧ
ࢲͷͨΊͷJenkins͔ͩΒ ࢲ͕ϝϯςͰ͖Ε͍͍
GitHub Organization Plugin • Multibranch Pipeline ͷ GitHub ಛԽ൛ •
ࣗͷΞΧϯτΛࢦఆ͢Δ͚ͩͰɺJenkinsfile Λ࣋ͭ ϦϙδτϦΛݕग़ͯ͠উखʹϏϧυͯ͘͠ΕΔ • ࠓճ https://github.com/yasuhiroki/myJenkinsfile ͚ͩ Λݕग़͢ΔΑ͏ʹઃఆ
δϣϒ = ϒϥϯν • jobs/* ͱ͍͏໊લͷϒϥϯν͕ɺJenkinsͷδϣϒʹͳΔ Α͏ઃఆ͢Δ • jobs/sendo, jobs/today-is
ͳͲɺδϣϒຖʹϒϥϯνΛ࡞ Δ
git worktree ίϚϯυ • δϣϒ͝ͱʹ͍͍ͪͪ checkout ͢Δͷ໘ͳͷͰɺ git worktree ίϚϯυΛར༻͢Δ
• git worktree add jobs/today-is jobs/today-is ͱ͢Δͱɺ jobs/today-is σΟϨΫτϦʹ jobs/today-is ϒϥϯν͕ νΣοΫΞτ͞ΕΔ • ϒϥϯνͷ͚ͩσΟϨΫτϦΛ࡞ͬͯ checkout ͢Εɺ δϣϒͷઃఆ͕ू·ͬͨ jobs σΟϨΫτϦͷͰ͖͕͋Γ
Jenkinsfile • ࢲͷͨΊͷࣥࣄΛޏ͏ʹ Jenkinsfile ͕ඞਢ • https://jenkins.io/doc/book/pipeline/syntax/ ࣥࣄޏ༻ ϚχϡΞϧ
ϊʔυͷཧ
ϊʔυͷཧ2ύλʔϯ • Docker Pipeline plugin • jenkinsci/jnlp-slave Docker Πϝʔδ
Docker Pipeline plugin • JenkinsfileͰϏϧυΛ࣮ߦ͍ͨ͠ docker image Λࢦఆ͢ Δ •
Jenkinsίϯςφͱಉ͡ docker.sock Λ͏Α͏ઃఆ͢Ε ɺJenkinsίϯςφࣗମ৮ΕΔ • ༡ͼϙΠϯτ • ྫɿࣥࣄةػҰήʔϜ
jenkinsci/jnlp-slave • ϊʔυ༻ίϯςφΛىಈ͠JenkinsʹJNLPͰଓ͢Δ • ࣥࣄΛαϙʔτ͢ΔϝΠυతଘࡏ • େྔʹ༻ҙͯ͠ϝΠυୂΛ࡞Δͷ͕Φεεϝ • δϣϒͷϏϧυDocker PipelineͰࣄΓΔͷͰɺ
ϝΠυ͞Μͱ༡Ϳ͜ͱʹूத͢Δ͜ͱ
jenkinsci/jnlp-slave • *.override ͷػೳΛͬͯɺࣄલʹϊʔυͷใΛ Jenkinsʹ༻ҙ͓ͯ͘͠ͱॳظߏஙΛ΄΅ࣗಈԽͰ͖Δ • secret τʔΫϯҰ࡞ΒΕͨΒ JENKINS_HOME ҎԼ
Λ࡞Γ͞ͳ͍ݶΓಉ͡ͳͷͰࣗಈԽͰ͖Δ • ॳճ͚ͩखಈͰొ͕ඞཁ • groovy ͰΰϦΰϦΕશࣗಈԽͰ͖Δؾ͕͢Δ
·ͱΊ
JenkinsΛͰ͖Δ͚ͩImmutableͯ͠Έͨ • DockerͱGitHubͱJenkinsfileͰ͋ΔఔImmutableʹͰ͖Δ • GroovyεΫϦϓτͰΰϦΰϦ͠ͳͯ͘ɺ Chef Ansible ͰΰϦΰϦ͠ͳͯ͘ɺ ΦϨΦϨεΫϦϓτͰΰϦΰϦ͠ͳͯ͘ɺ
͋Δఔɺ࠶ߏஙՄೳͳJenkinsڥ͕खʹೖΔ ɹ˞ ͨͩ͠ Docker ͷ͕ࣝඞཁ • Ͱ͖Δ͚ͩJenkinsຊମͷઃఆΛݮΒ͢ͷ͕େࣄ
FIN