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 と cron
Search
Yohei Kawahara
April 29, 2014
0
1.1k
Jenkins と cron
Jenkins で cron のジョブを見える化する!
Yohei Kawahara
April 29, 2014
Tweet
Share
More Decks by Yohei Kawahara
See All by Yohei Kawahara
20191002_CircleCIMeetupFukuoka#2
inokappa
1
810
kix_009_20190429
inokappa
0
810
2019-04-18 CircleCI Meetup Fukuoka #1
inokappa
2
8k
開発で使える AWS の API 操作を模倣する (OSS) ツールを探してみた/JAWS-UG Kagoshima Vol.8
inokappa
1
1.2k
隙間時間を使って exercism.io を始め隊 | リモートで勉強会 #2
inokappa
0
400
Congratulations fukuokarb#100
inokappa
0
3.9k
moto を 'もっと' 使おう/PyFukuoka#4
inokappa
0
4.4k
github-enterprise-user-kai-desuyone
inokappa
0
100
Elixir and AWS Tutorial
inokappa
0
540
Featured
See All Featured
Site-Speed That Sticks
csswizardry
0
25
How STYLIGHT went responsive
nonsquared
95
5.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Visualization
eitanlees
145
15k
Code Reviewing Like a Champion
maltzj
520
39k
We Have a Design System, Now What?
morganepeng
50
7.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
What's in a price? How to price your products and services
michaelherold
243
12k
Transcript
ςΩετ Jenkins ͱ cron Jenkins Ͱ cron ͷδϣϒΛݟ͑ΔԽ͠Α͏
୭ʁ @inokara
͓͢Δ͜ͱ ͜ΜͳΧΦεݟͨ͜ͱ͋Γ·͢ΑͶʁ cron δϣϒͷ݁Ռݟͯ·͔͢ʁ Jenkins ͬͯʁ Jenkins Ͱ cron ͷδϣϒΛݟ͑ΔԽ͠Α͏
σϞ
ಥવͰ͕͢…
ݟͨ͜ͱ͋Γ·͢ΑͶʁ
Ͳ͕͜ΧΦεʁ ͺͬͱݟͰԿͷδϣϒ͕ղΒͳ͍ ͺͬͱݟ୭͕ઃఆ͔ͨ͠ղΒͳ͍ ίϝϯτΞτͱ͔͞ΕͯΔ͠ ͦͦɺ݁ՌͬͯݟͯΔͷʁ
Ͱɺ݁Ռͬͯݟͯ·͔͢ʁ ͱΓࣦ͋͑ͣഊͨ͠ΒؔऀʹϝʔϧΛૹΔ /tmp/log ʹు͍͍ͯΔ͚ͩ…͔͠ /tmp/ /dev/null ʹϙʔΠ
͖͋·Μ͕ͳ…
ͦ͜Ͱ Jenkins ͷొʂ
None
Jenkins ͬͯʁʢ1ʣ ܧଓతͳΜͪΌΒʢContinuous integrationʣπʔ ϧͷҰͭ ςετͱ͔ύοέʔδϏϧυͱ͔ͰͬͯΔΑͶ όονΛ࣮ߦͯ͘͠ΕΔΑͶ ଞʹ৭ʑग़དྷΔΑʂৄ͘͠άάͬͯͶ
None
͑ɺͦͦ…Jenkins ͱ cron ͬͯ…
࿈ܞͬͯग़དྷΔͷʁ
ग़དྷ·͢ɻ
Jenkins ͬͯʁʢ2ʣ δϣϒͷεςʔλείʔυ 0 ͱͦΕҎ֎Ͱஅͯ͠ ·͢ 0 ͳΒSUCCESS 1 ຢͦΕҎ֎ͳΒ
FAILURE ͦͯ͠…
cron ͷ݁ՌΛόΠφϦΤϯίʔυͯ͠ XML ܗࣜͰεςʔλείʔυͱҰॹʹ POST ͢Δ ͱ݁ՌΛఆͯ͘͠ΕΔʂ
͏Ұ…
ʮ֎෦δϣϒͷࢹʯΛར༻ ݁ՌόΠφϦΤϯίʔυ εςʔλείʔυΛؚΊΔ XML ʹͯ͠ POST ͰϙΠ
<run> <log encoding="hexBinary">$(hexdump -v -e '1/1 "%02x"' $LOG)</log> <result>${RESULT}</result> <duration>${ELAPSED_MS}</duration>
</run>
σϞ
None
None
curl -X POST \ -d '<run><log encoding="hexBinary">4142430A</ log><result>0</result><duration>2000</ duration></run>' \
http://localhost:18080/jenkins/job/test/ postBuildResult
None
None
None
ͰɺԿ͕ΠΠͷʁ cron ͷδϣϒΛҰཡͰཧग़དྷΔ ͦΕͧΕͷδϣϒʹઆ໌͕͚ΒΕΔ ௨Λ Jenkins ʹͤΔ͜ͱ͕ग़དྷΔ ↑ʢͪΐ͍͕ඞཁʣ cron δϣϒͷॴཁ͕࣌ؒղΔ
·ͱΊ cron ͷδϣϒΧΦεʹͳΓ͕ͪ… δϣϒͷ݁Ռແࢹ͞Ε͕ͪ… Jenkins ͷδϣϒʹ݁ՌΛ POST ͢Ε݁ՌΛҰཡ ͰݟΔ͜ͱ͕ग़དྷΔʂ δϣϒͷઆ໌Λॻ͚
cron ʹઆ໌Λ͚Δ͜ͱ͕ग़ དྷΔͷͰ୭͕͍ͭͲͷΑ͏ʹઃఆ͔ͨ͠ղΔʂ
࣭ʂʁ