๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Develop

๐Ÿ—ฃ "์‹œ๋ฆฌ์•ผ ๋ฐฐํฌํ•ด์ค˜" (Travis CI)

๐Ÿ—ฃ ์„œ๋ก 

์šฐ์•„ํ•œํ…Œํฌ์ฝ”์Šค ๋งˆ์ง€๋ง‰ ํ”„๋กœ์ ํŠธ์—์„œ ์•ˆ๋Œ์˜ ์‹œ๋ฆฌ ๋ฐฐํฌ๋ฅผ ๋ดค์—ˆ๋‹ค. ๊ทธ๋•Œ ์‹ ๊ธฐํ–ˆ๋˜ ๊ธฐ์–ต์ด ์žˆ์–ด์„œ ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์— ์‹œ๋ฆฌ๋กœ ๋ฐฐํฌํ•ด๋ณด๋Š” ๊ฒƒ์„ ์ ์šฉํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค. ํ•˜์ง€๋งŒ ์ด๋ถ„์˜ ๋ธ”๋กœ๊ทธ์—๋Š” Jenkins๋ฅผ ์ด์šฉ ํ–ˆ์—ˆ๊ณ , Travis CI๋ฅผ ์ด์šฉํ•˜๊ณ  ์žˆ๋˜ ๋‚˜๋Š” ๊ณ„์†ํ•ด์„œ ๋ฐฉ๋ฒ•์„ ์ฐพ์•˜๋‹ค.

์ด๋ฒˆ ๊ธ€์€ Travis CI ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์‹œ๋ฆฌ๋กœ ๋ฐฐํฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์–˜๊ธฐํ•˜๊ณ ์ž ํ•œ๋‹ค. ์‹œ์ž‘ํ•˜๊ธฐ ์•ž์„œ ์•„๋ž˜ ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์ž.

๋‚˜๋Š” TravisCI๋ฅผ org์—์„œ ์ด์šฉํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฒˆ๊ธ€์€ org์—์„œ ์ด์šฉํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๊ณ  ์„ค๋ช…ํ•˜๋ ค๊ณ  ํ•œ๋‹ค.

travis-ci.com์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋Š” --org ๋Œ€์‹  --com์„ ์ž…๋ ฅํ•˜๊ณ , https://api.travis-ci.com์— ์š”์ฒญํ•ด์•ผ ํ•œ๋‹ค.

๐Ÿ“Œ 1๋‹จ๊ณ„

Travis CI ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ API ํ† ํฐ์„ ์–ป๋Š”๋‹ค.

travis login --org //๋ช…๋ น์–ด ์‹คํ–‰ ํ›„ Github ๋‹‰๋„ค์ž„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅ
travis token --org //๋ช…๋ น์–ด ์‹คํ–‰ ํ›„ ํ† ํฐ ์ €์žฅ

๐Ÿ“Œ 2๋‹จ๊ณ„: ์ฐธ๊ณ ๋งŒ

๊ทธ๋ฆผ[1] - Repository

API์— POST ์š”์ฒญ์„ ๋ณด๋‚ธ๋‹ค. ๋‚˜๋Š” hyojaekim/chatbot ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— master ๋ธŒ๋žœ์น˜์˜ ์ตœ์‹  ์ปค๋ฐ‹์„ ๋ฐฐํฌํ•˜๊ณ ์ž ํ•œ๋‹ค.

body='{"request": { "branch":"master" }}'

curl -s -X POST \
   -H "Content-Type: application/json" \
   -H "Accept: application/json" \
   -H "Travis-API-Version: 3" \
   -H "Authorization: token xxxxxx" \
   -d "$body" \
   https://api.travis-ci.org/repo/hyojaekim%2Fchatbot/requests

 

์—ฌ๊ธฐ์„œ ์ค‘์š”ํ•œ ๊ฒƒ์€ 2๊ฐ€์ง€๋‹ค.

1. xxxxxx ๋ถ€๋ถ„์— 1๋‹จ๊ณ„์—์„œ ์ €์žฅํ•œ ํ† ํฐ์„ ์ž…๋ ฅํ•œ๋‹ค.

  -H "Authorization: token xxxxxx" \

 

2. org์ธ์ง€ com์ธ์ง€ ํ™•์ธํ•˜์ž
hyojaekim%2Fchatbot -> ์—ฌ๊ธฐ์„œ %2F์œผ๋กœ ์•ž์—๋Š” ์ด๋ฆ„(hyojaekim)๊ณผ ๋ ˆํฌ์ง€ํ† ๋ฆฌ(chatbot)๋กœ ๊ตฌ๋ถ„ํ•œ๋‹ค.

  https://api.travis-ci.org/repo/hyojaekim%2Fchatbot/requests

 

์š”์ฒญ์„ ๋ณด๋‚ด๋ณด๋ฉด ์ •์ƒ์ ์œผ๋กœ ๋นŒ๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ ์šฐ๋ฆฌ๊ฐ€ ์›ํ•˜๋Š” ๊ฒƒ์€ ์‹œ๋ฆฌ ๋ฐฐํฌ๋‹ค.

๐Ÿ“Œ 3๋‹จ๊ณ„: ๋ณธ๊ฒฉ์ ์ธ ๋‹จ๊ณ„

๋จผ์ € ์•„์ดํฐ์ด๋ผ๋ฉด ๋‹จ์ถ•์–ด ์•ฑ์„ ํ‚ค๊ณ , ์•„๋ž˜ ๊ทธ๋ฆผ์„ ๋”ฐ๋ผํ•ด๋ณด์ž.

๊ทธ๋ฆผ[2] - ๋‹จ์ถ•์–ด ์ƒ์„ฑ ํด๋ฆญ

 

๊ทธ๋ฆผ[3] - ๋™์ž‘ ์ถ”๊ฐ€ ํด๋ฆญ

 

๊ทธ๋ฆผ[4] - ์›น ์•„์ด์ฝ˜ ํด๋ฆญ

 

๊ทธ๋ฆผ[5] - URL ์ฝ˜ํ…์ธ  ๊ฐ€์ ธ์˜ค๊ธฐ ํด๋ฆญ

 

๊ทธ๋ฆผ[6] - URL, Method, Header, Body ์ž…๋ ฅํ•˜๊ธฐ

 

์œ„ ๊ทธ๋ฆผ์— ์•„๋ž˜ ๋‚ด์šฉ๋“ค์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

//URL
https://api.travis-ci.org/repo/hyojaekim%2Fchatbot/requests

//๋ฉ”์†Œ๋“œ
POST

//ํ—ค๋”(Key / Value)
Travis-API-Version / 3
Authorization/token xxxxxx

//๋ณธ๋ฌธ ์š”์ฒญ(JSON, Key / Value)
request.branch / master

๊ทธ๋ฆผ[7] - ์™„์„ฑ
๊ทธ๋ฆผ[8] - ๋ฐฐํฌ ์™„๋ฃŒ

 

 

 

 

์‹œ๋ฆฌ์•ผ ์•ฑ ๋ฐฐํฌํ•ด์ค˜ · Soojin Ro

์‹œ๋ฆฌ ์‘๋‹ต์ด ์›ฐ์ผ€ ์• ์ž”ํ•˜๋ƒ... ๋ฐฐ๊ฒฝ ์˜ฌํ•ด ์ดˆ ์  ํ‚จ์Šค CI ์„œ๋ฒ„ ๊ตฌ์ถ•์„ ์ฒ˜์Œ ํ•ด๋ดค๊ณ , ๊ทธ๊ฑธ ๊ณ„๊ธฐ๋กœ ์ž๋™ํ™”์— ๊ด€์‹ฌ์ด ์ƒ๊ฒจ ์ผ ๋…„ ๋™์•ˆ ํ‹ˆํ‹ˆ์ด ํŒ€ ๋‚ด ๋ฐฐํฌ/๊ฐœ๋ฐœ ํ”„๋กœ์„ธ์Šค๋ฅผ ๊ฐœ์„ ์‹œ์ผœ์™”๋‹ค. ์‚ฌ์‹ค ๊ด€์‹ฌ์ด ์ƒ๊ฒผ๋‹ค๋Š” ๋ง์€ ๋นˆ์•ฝํ•œ ํ‘œํ˜„์ด๊ณ  ๋‚˜๋Š” ๋‚ด๊ฐ€ ์ด ์ •๋„๋กœ ์˜๋ฏธ์—†๋Š” ๋ฐ˜๋ณต ์ž‘์—…์„ ์‹ซ์–ดํ•˜๋Š” ์‚ฌ๋žŒ์ธ์ค„ ๋ชฐ๋ž๋‹ค. ์•„๋ฌด ์ƒ๊ฐ์—†์ด ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐ˜๋ณต ์ž‘์—…๋„ ๊ฐ€๋”์”ฉํ•˜๋ฉด ์ •์‹  ๊ฑด๊ฐ•์— ์ข‹๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์—ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ฐœ๋ฐœ ํ”„๋กœ์„ธ์Šค์— ๋…น์•„์žˆ๋˜ ์ˆ˜์ž‘์—…์ด ํ•˜๊ธฐ ์‹ซ์–ด์„œ ์–ด๋–ป๊ฒŒ๋“  ์ž๋™ํ™”ํ•  ๋ฐฉ๋ฒ•์„ ์ฐพ

soojin.ro

 

Travis CI Documentation

Triggering builds with API V3

docs.travis-ci.com