GitLab๐ŸฆŠ: CI/CD

์ •์€๊ฒฝยท2020๋…„ 7์›” 9์ผ
0

์ผ๋ฐ˜์ ์ธ job:

  • ํ…Œ์ŠคํŠธ: ์œ ๋‹› ํ…Œ์ŠคํŠธ, ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ, E2E ํ…Œ์ŠคํŠธ, ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€ ์ธก์ •
  • ๋ฆฐํŠธ: ์ฝ”๋“œ ํ€„๋ฆฌํ‹ฐ ์ธก์ •, ์ฝ”๋“œ ์ปจ๋ฒค์…˜ ์ ๊ฒ€
  • ๋นŒ๋“œ: ๋นŒ๋“œ, ๋ฒˆ๋“ค๋ง, Dockerfile ๋นŒ๋“œ ๋ฐ ์ปจํ…Œ์ด๋„ˆ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ํ‘ธ์‹œ
  • ๋ฐฐํฌ: Helm Chart, KNative Functions, KNative App(์ปจํ…Œ์ด๋„ˆ) ๋ฐฐํฌ

๊นƒ๋žฉ์œผ๋กœ CI/CDํ•˜๊ธฐ

gitlab-runner๋ฅผ ์›น์„œ๋ฒ„์— ์„ค์น˜ํ•˜๊ณ 
gitlab ๋ ˆํฌ์ง€ํ„ฐ๋ฆฌ์—์„œ ์ž‘์„ฑํ•œ .yml ์ฝ”๋“œ์— commit ๋ ๋•Œ๋งˆ๋‹ค ๋ฐฐํฌํ•˜๋„๋ก ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋ฉด ok!

Reference

Reference


CI/CD (์œ„ํ‚คํ”ผ๋””์•„ ์ž๋ฃŒ ๋ฒˆ์—ญ)

์†Œํ”„์›จ์–ด ๊ณตํ•™์—์„œ CI/CD ๋˜๋Š” CICD๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์ง€์†์  ํ†ตํ•ฉ(continuous integration) ๋˜๋Š” ์ง€์†์ ์ธ ์ „๋‹ฌ(Continous delivery)/์ง€์†์ ์ธ ๋ฐฐํฌ(continuous deployment)๋ฅผ ์กฐํ•ฉํ•œ ๊ด€์Šต?(practice)์„ ์˜๋ฏธํ•œ๋‹ค.

๊ธฐ์—…ํ™๋ณด(coporate communication)์˜ ๋งฅ๋ฝ์—์„œ,
CI/CD๋Š” ๊ธฐ์—…์˜ ์ •์ฒด์„ฑ(coporate identity)๊ณผ ๊ธฐ์—… ๋””์ž์ธ(corporate design)์˜ ์ „๋ฐ˜์ ์ธ ๊ณผ์ •์„ ์˜๋ฏธํ•  ์ˆ˜ ์žˆ๋‹ค

CI/CD๋Š” ๋ฌด์—‡์ธ๊ฐ€ (RedHat ์ž๋ฃŒ ๋ฒˆ์—ญ)

CI/CD๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ ๋‹จ๊ณ„๋กœ ์ž๋™ํ™”ํ•จ์œผ๋กœ์จ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ณ ๊ฐ์—๊ฒŒ ์ž์ฃผ ๋ฐฐํฌ(deliver)ํ•˜๋Š” ๋ฐฉ๋ฒ•๋ก ์ด๋‹ค.
CI/CD์˜ ์ฃผ๋œ ๋ฉ”์ธ ์ฝ˜์…‰ํŠธ๋Š” ์ง€์†์ ์ธ ํ†ตํ•ฉ(integration)/์ „๋‹ฌ(delivery)/๋ฐฐํฌ(development)์ด๋‹ค.
CI/CD๋Š” ๊ฐœ๋ฐœ/์šด์˜ํŒ€์—๊ฒŒ ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ๋Š” ์ƒˆ๋กœ์šด ์ฝ”๋“œ๋ฅผ ํ†ตํ•ฉํ•˜๋Š” ๋ฌธ์ œ(integration hell)์— ๋Œ€ํ•œ ํ•ด๊ฒฐ์ฑ…์ด๋‹ค.

๊ตฌ์ฒด์ ์œผ๋กœ, CI/CD๋Š” ํ†ตํ•ฉ/ํ…Œ์ŠคํŠธ ๋‹จ๊ณ„๋ถ€ํ„ฐ ์ „๋‹ฌ/๋ฐฐํฌ๊นŒ์ง€์— ์ด๋ฅด๋Š” ์‘์šฉํ”„๋กœ๊ทธ๋žจ์˜ ๋ผ์ดํ”„์‚ฌ์ดํด ์ „๋ฐ˜์— ๊ฑธ์นœ ์ž๋™ํ™”์™€ ์ง€์†์ ์ธ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ์ œ์‹œํ•œ๋‹ค.
์ด ๋ชจ๋“  ๊ฒƒ์„ ํ•จ๊ป˜ ์—ฐ๊ฒฐ๋˜์—ˆ๋‹ค๊ณ  ํ•˜์—ฌ ์ข…์ข… 'CI/CD ํŒŒ์ดํ”„๋ผ์ธ'์ด๋ผ๊ณ  ๋ถ€๋ฅด๋ฉฐ, ์• ์ž์ผ ๋ฐฉ์‹์œผ๋กœ "๊ฐœ๋ฐœ๊ณผ ์šด์˜ํŒ€์˜ ํ˜‘์—…(development and operations teams working together)"์œผ๋กœ ์ง€์ง€๋˜๊ณ  ์žˆ๋‹ค.

CI์™€ CD(๊ทธ๋ฆฌ๊ณ  ๋‹ค๋ฅธ CD)์˜ ์ฐจ์ด์ ์€ ๋ฌด์—‡์ธ๊ฐ€?

CI/CD๋Š” ์กฐ๊ธˆ์€ ๋‹ค๋ฅธ ์˜๋ฏธ์˜ ์ค„์ž„๋ง์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.
CI/CD์˜ 'CI'๋Š” ๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ์ž๋™ํ™”๋œ ํ”„๋กœ์„ธ์Šค์ธ,
'์ง€์†์ ์ธ ํ†ตํ•ฉ(continuous integration)'์„ ์˜๋ฏธํ•œ๋‹ค.
์„ฑ๊ณต์ ์ธ CI๋Š” ์•ฑ์— ์ ์šฉ๋˜๋Š” ์ƒˆ๋กœ์šด ์ฝ”๋“œ๊ฐ€ ์ •๊ธฐ์ ์œผ๋กœ build/test/merge๋จ์„ ์˜๋ฏธํ•œ๋‹ค.
์ด๋Š” ๊ฐœ๋ฐœ๋‹จ๊ณ„์—์„œ ๋„ˆ๋ฌด ๋งŽ์€ ๋ธŒ๋žœ์น˜๊ฐ€ ์žˆ๊ณ , ์„œ๋กœ๊ฐ€ ์ถฉ๋Œ๋ ์ง€๋„ ๋ชจ๋ฅธ๋‹ค๋Š” ๊ฒƒ์— ๋Œ€ํ•œ ํ•ด๊ฒฐ์ฑ…์ด๋‹ค.

CI/CD์˜ 'CD'๋Š” ์ง€์†์ ์ธ ์ „๋‹ฌ(delivery)/๋ฐฐํฌ(deployment)๋ฅผ ์˜๋ฏธํ•œ๋‹ค.
์ „๋‹ฌ/๋ฐฐํฌ ๋ชจ๋‘ ํŒŒ์ดํ”„๋ผ์ธ์˜ ๋” ๋‚˜์•„๊ฐ„ ๋‹จ๊ณ„๋ฅผ ์ž๋™ํ™”ํ•˜์ง€๋งŒ,
์ „๋‹ฌ/๋ฐฐํฌ๋Š” ๊ฐ€๋” ์–ผ๋งˆ๋‚˜ ์ž๋™ํ™”๊ฐ€ ์ด๋ค„์ง€๊ณ  ์žˆ๋Š”์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด์„œ ๊ตฌ๋ถ„๋˜์–ด ์‚ฌ์šฉ๋˜๊ธฐ๋„ ํ•œ๋‹ค.

์ง€์†์ ์ธ ์ „๋‹ฌ(delivery)์€ ๋ณดํ†ต ๊ฐœ๋ฐœ์ž์˜ ์•ฑ์— ๋Œ€ํ•œ ๋ณ€ํ™”๊ฐ€ ์ž๋™์ ์œผ๋กœ ๋ฒ„๊ทธ ํ…Œ์ŠคํŠธ๋˜๊ณ ,
์šด์˜ํŒ€์— ์˜ํ•ด์„œ live production ํ™˜๊ฒฝ์— deploy๋  ์ˆ˜ ์žˆ๋Š” ๋ ˆํผ์ง€ํ† ๋ฆฌ์— ์—…๋กœ๋“œ ๋˜๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค.
์ด๋Š” ๊ฐœ๋ฐœํŒ€๊ณผ ๋น„์ฆˆ๋‹ˆ์Šค ํŒ€ ๊ฐ„์˜ ๋ถ€์กฑํ•œ ๊ฐ€์‹œํ™”์™€ ์ปค๋ฎค๋‹ˆ์ผ€์ด์…˜ ๋ฌธ์ œ์˜ ํ•ด๋‹ต์ด ๋œ๋‹ค.
๊ทธ ๋ฌธ์ œ๋ฅผ ๋๋‚ด๊ธฐ ์œ„ํ•ด์„œ๋Š”,
์ง€์†์ ์ธ ์ „๋‹ฌ(delivery)์˜ ๋ชฉ์ ์€ ์ƒˆ๋กœ์šด ์ฝ”๋“œ๋ฅผ ๋ฐฐํฌํ•˜๋Š”๋ฐ ์ตœ์†Œํ•œ์˜ ๋…ธ๋ ฅ์ด ๋“ ๋‹ค๋Š” ๊ฒƒ์„ ํ™•์‹คํžˆ ํ•˜๊ธฐ ์œ„ํ•จ์ด๋‹ค.

์ง€์†์ ์ธ ๋ฐฐํฌ(CD, Continuous Deployment)๋Š”
์ž๋™ํ™”์ ์œผ๋กœ ๋ ˆํฌ์ง€ํ„ฐ๋ฆฌ์—์„œ ์ œํ’ˆ(๊ณ ๊ฐ์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”)์œผ๋กœ ๊ฐœ๋ฐœ์ž์˜ ๋ณ€ํ™”๋ฅผ ๋ฆด๋ฆฌ์ฆˆ ํ•  ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•œ๋‹ค.
CD๋Š” ์•ฑ ์ „๋‹ฌ(delivery)์„ ๋Šฆ์ถ”๋Š” ๋ฉ”๋‰ด์–ผ ํ”„๋กœ์„ธ์Šค๋กœ ์ธํ•œ ์šด์˜ํŒ€์˜ ์˜ค๋ฒ„๋กœ๋”ฉ ๋ฌธ์ œ๋ฅผ ์„ค๋ช…ํ•œ๋‹ค.
ํŒŒ์ดํ”„๋ผ์ธ์—์„œ์˜ ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ์ž๋™ํ™”ํ•จ์œผ๋กœ์จ CD์˜ ์ด์ ์„ ๋งŒ๋“ ๋‹ค.

๊ฐ„๋‹จํ•˜๊ฒŒ,
CI/CD๋Š” ํ”„๋กœ์„ธ์Šค๋‹ค
์ข…์ข… ํŒŒ์ดํ”„๋ผ์ธ์˜ ํ˜•ํƒœ๋กœ ์‹œ๊ฐํ™”๋œ๋‹ค
๋†’์€ ์ˆ˜์ค€์˜ ์ž๋™ํ™”์™€ ์•ฑ๊ฐœ๋ฐœ์— ๋Œ€ํ•œ ์ง€์†์ ์ธ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ํฌํ•จํ•œ๋‹ค.

Continuous Integration

ํ˜„๋Œ€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ์—์„œ์˜ ๋ชฉ์ ์€, ์—ฌ๋Ÿฌ ๊ฐœ๋ฐœ์ž๋“ค์ด ํ†ต์‹œ์— ๋‹ค๋ฅธ ๊ธฐ๋Šฅ์„ ๊ฐœ๋ฐœํ•˜๋Š” ๊ฒƒ์ด๋‹ค.
๊ทธ๋Ÿฌ๋‚˜, ํ•˜๋ฃจ์— ๋ชจ๋“  ๋ธŒ๋žœ์น˜๋“ค์˜ ์ฝ”๋“œ๋ฅผ mergeํ•œ๋‹ค๋ฉด,
๊ทธ ๊ฒฐ๊ณผ๋Š” ๋น„๊ทน์ ์ด๊ณ , ๊ณ ๋˜๊ณ , ์‹œ๊ฐ„์ด ๋งŽ์ด ๋“œ๋Š” ์ž‘์—…์ด ๋  ๊ฒƒ์ด๋‹ค.
๊ทธ๋ž˜์„œ!

CI๋Š” ๊ฐœ๋ฐœ์ž๋“ค์˜ ๊ทธ๋“ค์˜ ์ฝ”๋“œ๋ฅผ ์‰์–ดํ•œ ๋ธŒ๋žœ์น˜์— ๋‹ค์‹œ mergeํ•˜๋Š” ๊ฒƒ์„ ๋„์™€์ค€๋‹ค.
ํ•œ๋ฒˆ ๊ฐœ๋ฐœ์ž๊ฐ€ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์„ ๋ณ€๊ฒฝํ•œ ๊ฒƒ์ด merge๋˜๋ฉด, ๊ทธ ๋ณ€๊ฒฝ์‚ฌํ•ญ์€ ์ž๋™์ ์œผ๋กœ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์„ ๋นŒ๋“œํ•˜๊ณ  ๋‹ค๋ฅธ ๋ ˆ๋ฒจ์˜ ์ž๋™ํ™”๋œ ํ…Œ์ŠคํŠธ๋กœ ๊ฒ€์ฆ(validate)๋œ๋‹ค.

Continuous Delievery

CI์—์„œ์˜ build/unit์˜ ์ž๋™ํ™”์™€ ํ†ตํ•ฉํ…Œ์ŠคํŠธ, ์ง€์†์ ์ธ delivery๋Š”
๊ฒ€์ฆ๋œ ์ฝ”๋“œ๊ฐ€ ๋ ˆํผ์ง€ํ† ๋ฆฌ๋กœ ๋ฆด๋ฆฌ์ฆˆ๋˜๋Š” ๊ฒƒ์„ ์ž๋™ํ™”ํ•œ๋‹ค.
ํšจ๊ณผ์ ์ธ CD ํ”„๋กœ์„ธ์Šค๋ฅผ ์œ„ํ•ด์„œ๋Š” CI๊ฐ€ ๋‹น์‹ ์˜ ๊ฐœ๋ฐœ ํŒŒ์ดํ”„๋ผ์ธ์— ์ด๋ฏธ ๊ตฌ์„ฑ๋˜์–ด์žˆ์–ด ํ•จ์„ ๊ฐ•์กฐํ•œ๋‹ค.
CI์˜ ๋ชฉํ‘œ๋Š” production ํ™˜๊ฒฝ์œผ๋กœ ๋ฐฐํฌ๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ฝ”๋“œ๋ฒ ์ด์Šค๋ฅผ ๊ฐ–๋Š” ๊ฒƒ์ด๋‹ค.

CD์—์„œ, merget/delivery/buใ…–๋“ค์€ ์ž๋™ํ™”์™€ ์ฝ”๋“œ ๋ฆด๋ฆฌ์ฆˆ ์ž๋™ํ™”๋ฅผ ํฌํ•จํ•œ๋‹ค.
์ด๋Ÿฌํ•œ ๊ณผ์ •์˜ ๋์—๋Š”,
์šด์˜ํŒ€์ด production์œผ๋กœ ๋น ๋ฅด๊ฒŒ ์‰ฝ๊ฒŒ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ๋‹ค.

Continuous Deployment

์„ฑ์ˆœํ•œ CI/CD ํŒŒ์ดํ”„๋ผ์ธ์˜ ๋งˆ์ง€๋ง‰ ๋‹จ๊ณ„๋Š” ์ง€์†์ ์ธ ๋ฐฐํฌ์ด๋‹ค.
์ฝ”๋“œ ๋ ˆํผ์ง€ํ† ๋ฆฌ์— production-ready ๋นŒ๋“œ ๋ฆด๋ฆฌ์ฆˆ๋ฅผ ์ž๋™ํ™”ํ•˜๋Š” CD์˜ ํ™•์žฅ์œผ๋กœ,
CD๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ œํ’ˆ์œผ๋กœ ๋ฆด๋ฆฌ์ฆˆํ•˜๋Š” ๊ฒƒ์„ ์ž๋™ํ™”ํ•œ๋‹ค.
์™œ๋ƒํ•˜๋ฉด, production ์ „ ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„์—๋Š” ์ •ํ˜•ํ™”๋œ ๊ฒƒ์ด ์—†์–ด์„œ,
CD๋Š” ์ž˜ ์„ค๊ณ„๋œ ํ…Œ์ŠคํŠธ ์ž๋™ํ™”์— ์‹ฌํ•˜๊ฒŒ ์˜์กดํ•œ๋‹ค.

Reference

profile
#์˜์‹์˜ํ๋ฆ„ #์ˆœ๊ฐ„์ˆœ๊ฐ„ #์ƒ๊ฐ์˜์Šค๋ƒ…์ƒท

0๊ฐœ์˜ ๋Œ“๊ธ€