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.2k
開発者(個人)のためのJenkins 運用編
第11回 Jenkins勉強会 LT
Yasuhiroki
November 08, 2017
Tweet
Share
More Decks by Yasuhiroki
See All by Yasuhiroki
自分に勉強させるには
yasuhiroki
1
390
Android Studio `Command+Shift+A`
yasuhiroki
0
320
シェルスクリプトをサーバーレスで cron したい
yasuhiroki
1
770
rails new コマンド
yasuhiroki
1
710
自動化を習慣化する
yasuhiroki
2
14k
GitHub Actions Parallel Testing
yasuhiroki
1
1.2k
circleci.vim
yasuhiroki
0
1.5k
ベンチャー企業がCircleCIを選んだ理由と活用方法
yasuhiroki
1
770
Rubyの正規表現を調べてみた
yasuhiroki
0
800
Other Decks in Technology
See All in Technology
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
CustomCopを使ってMongoidのコーディングルールを整えてみた
jinoketani
0
220
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
520
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
220
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Navigating Team Friction
lara
183
15k
How to Ace a Technical Interview
jacobian
276
23k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Typedesign – Prime Four
hannesfritz
40
2.4k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
YesSQL, Process and Tooling at Scale
rocio
169
14k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Embracing the Ebb and Flow
colly
84
4.5k
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