Springboot Gradle + AWS EC2 + Jenkins + Docker๋กœ ๋ฐฐํฌ๊นŒ์ง€(3) : Jenkins gradle ์•„์ดํ…œ ์ƒ์„ฑ ๋ฐ ์„ค์ •ํ•˜๊ธฐ

2021. 4. 30. 16:37ใ†๐ŸŒฑ Develop/devOps

1๏ธโƒฃ ์•„์ดํ…œ ์ƒ์„ฑ, ์„ค์ •ํ•˜๊ธฐ

์ด์ „ ํฌ์ŠคํŒ…์—์„œ ์•„์ดํ…œ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ์‚ฌ์ „ ์ค€๋น„๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์ œ ์ƒˆ๋กœ์šด item์„ ๋ˆŒ๋Ÿฌ์„œ ์•„์ดํ…œ์„ ๋งŒ๋“ค์–ด๋ด…์‹œ๋‹ค.

 

freestyle project๋กœ ์›ํ•˜๋Š” ์ด๋ฆ„์˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•œ ๋’ค, ์†Œ์Šค ๊ด€๋ฆฌ์—์„œ ์•„๊นŒ Credential์— ์ถ”๊ฐ€ํ•œ ๊นƒํ—™ ํ‚ค๋ฅผ ์ ์šฉํ•ด์ค๋‹ˆ๋‹ค. 1๋ฒˆ์งธ ๋ฐฉ์‹์ธ ๊นƒํ—ˆ๋ธŒ ์•„์ด๋””/๋น„๋ฒˆ ์ž…๋ ฅ ๋Œ€์‹  ssh ํ‚ค๋กœ ์ธ์ฆํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

github ๋ ˆํฌ์ง€ํ† ๋ฆฌ์™€ ์—ฐ๊ฒฐ

 

์ €๋Š” master ๋ธŒ๋žœ์น˜์— push ํ•˜๋Š” ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•  ๋•Œ ๋นŒ๋“œํ•˜๋„๋ก ์„ค์ •ํ•ด๋‘์—ˆ์Šต๋‹ˆ๋‹ค.

 

 

Build Invoke Gradle script๋ฅผ ์„ ํƒํ•˜๊ณ  gradle ๋ฒ„์ „์€ ์ด์ „ ํฌ์ŠคํŒ…์—์„œ ๋ฏธ๋ฆฌ ์ €์žฅํ•œ gradle๋กœ ์„ค์ •ํ•ด์ค๋‹ˆ๋‹ค.

 

 

2๏ธโƒฃ ๋นŒ๋“œ ํ…Œ์ŠคํŠธํ•ด๋ณด๊ธฐ

์ด์ œ ๋Œ€์‹œ๋ณด๋“œ๋กœ ๋“ค์–ด๊ฐ€์„œ Build Now ๋ฅผ ํ•˜๊ณ  ์ฝ˜์†” ์ถœ๋ ฅ์—์„œ success๋ฅผ ํ™•์ธํ•ด๋ด…์‹œ๋‹ค.

์—ฌ๊ธฐ๊นŒ์ง€ ๋”ฐ๋ผ์™”์œผ๋ฉด Github-Jenkins ์—ฐ๋™๊นŒ์ง€ ์™„์„ฑ์ž…๋‹ˆ๋‹ค! 

 

 

๐Ÿฅฒ EC2๊ฐ€...๋จนํ†ต์ด ๋˜๋Š”๋ฐ์š”....?

ํ•˜์ง€๋งŒ ๋นŒ๋“œ๋ฅผ ํ•˜๋ ค๊ณ  ํ•˜๋ฉด ec2 ์ฐฝ๊ณผ Jenkins ๋ชจ๋‘ ๋ฉˆ์ถฐ๋ฒ„๋ฆฌ๋Š” ํ˜„์ƒ์ด ๋‚˜ํƒ€๋‚˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค. 

๋ฌธ์ œ๋Š” ec2 ํ”„๋ฆฌํ‹ฐ์–ด ์‚ฌ์–‘์ด Jenkins๋ฅผ ๋Œ๋ฆฌ๊ธฐ์— ๋ถ€์กฑํ•˜๊ธฐ ๋•Œ๋ฌธ์ธ๋ฐ์š”, ๊ทธ๋Ÿผ ์“ฐ์ง€ ๋ง์•„์•ผํ•˜๋‚˜...?๋Š” ์•„๋‹™๋‹ˆ๋‹ค. ๋‹ค์Œ ํฌ์ŠคํŒ…์„ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”!