Jenkins Bitbucket Credentials - XXOK/XXOK-selenium GitHub Wiki

1. ์  ํ‚จ์Šค์— Bitbucket ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜

jenkins_plugin

Jenkins ํŽ˜์ด์ง€์— ์ ‘์†ํ•œ ํ›„ Jenkins ๊ด€๋ฆฌ -> ํ”Œ๋Ÿฌ๊ทธ์ธ ๊ด€๋ฆฌ ์— ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค.


bitbucket_plugin

์„ค์น˜ ๊ฐ€๋Šฅ ํƒญ์œผ๋กœ ์ด๋™ํ•˜๊ณ  ์šฐ์ธก ์ƒ๋‹จ์˜ ํ•„ํ„ฐ๋ž€์— bitbucket plugin ์„ ์ž…๋ ฅํ•˜์—ฌ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์•„๋ž˜ ๊ฒฐ๊ณผ์—์„œ Bitbucket Plugin์˜ ์ขŒ์ธก ์ฒดํฌ๋ฐ•์Šค๋ฅผ ์ฒดํฌํ•˜๊ณ  "์ง€๊ธˆ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์žฌ์‹œ์ž‘ ํ›„ ์„ค์น˜ํ•˜๊ธฐ"๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.


bitbucket_plugin_update

๊ธฐ๋‹ค๋ ธ๋‹ค๊ฐ€ ์„ค์น˜๊ฐ€ ๋๋‚˜๋ฉด "์„ค์น˜๊ฐ€ ๋๋‚˜๊ณ  ์‹คํ–‰์ค‘์ธ ์ž‘์—…์ด ์—†์œผ๋ฉด jenkins ์žฌ์‹œ์ž‘"์„ ํด๋ฆญํ•ด Jenkins ์žฌ์‹œ์ž‘์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.


2. ์  ํ‚จ์Šค Item ์ƒ์„ฑ

jenkins_new_item

์  ํ‚จ์Šค ๋ฉ”์ธ ํŽ˜์ด์ง€์—์„œ "์ƒˆ๋กœ์šด item"์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.


jenkins_new_item_configuration

item์˜ ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜๊ณ  Freestyle project์„ ์„ ํƒํ•˜๊ณ  ํ•˜๋‹จ์— OK๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค.


jenkins_new_item_git_configuration

๋‹ค์Œ์œผ๋กœ ์„ค์ •์ฐฝ์ด ๋œน๋‹ˆ๋‹ค.

์†Œ์Šค ์ฝ”๋“œ ๊ด€๋ฆฌ๋กœ ๊ฐ€์„œ Git์„ ์ฒดํฌ ํ•ด์ฃผ๋ฉด ์ž…๋ ฅํผ์ด ํ™œ์„ฑํ™”๊ฐ€ ๋˜๋Š”๋ฐ

Repository URL์—๋Š” Bitbucket์˜ ํ”„๋กœ์ ํŠธ ์ €์žฅ์†Œ URL์„ ์ž…๋ ฅํ•˜๊ณ 

Credentials์—๋Š” Add->Jenkins๋ฅผ ๋ˆŒ๋Ÿฌ ์ธ์ฆ์ •๋ณด๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์„ ํƒํ•ด์ค๋‹ˆ๋‹ค. (์ค‘์š”)


add_credentials

(Credentials->Add->Jenkins๋ฅผ ์„ ํƒํ•˜๋ฉด ๋œจ๋Š” ํ™”๋ฉด)

์—ฌ๋Ÿฌ ์ธ์ฆ๋ฐฉ๋ฒ•์ด ์žˆ๊ฒ ์ง€๋งŒ ์—ฌ๊ธฐ์„œ๋Š” Bitbucket์˜ Username๊ณผ Password๋กœ ์ธ์ฆ์ •๋ณด๋ฅผ ์ƒ์„ฑํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

Username์—๋Š” Bitbucket์˜ Username(๊ณ„์ • id ์•„๋‹˜) Password์—๋Š” Bitbucket์˜ ํŒจ์Šค์›Œ๋“œ๋ฅผ ์ž…๋ ฅ ํ›„ Add๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค.


Excute Shell ์„ ํƒ ํ›„ ์•„๋ž˜ ์ฝ”๋“œ ์ž…๋ ฅ (๋ถ™ํ˜€๋„ฃ๊ธฐ ์‹œ ์Œ๋”ฐ์˜ดํ‘œ๋ฅผ ๋‹ค์‹œ ์ ์–ด์ฃผ์ž)

PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH

if which pyenv > /dev/null; then eval โ€œ$(pyenv init -)โ€œ; fi

export PYTHONIOENCODING=UTF-8

pyenv shell 3.6.5

pip install -r requirements.txt

pytest -v -s

brew install pyenv

pyenv install -list

pyenv install 3.6.5


build_trigger

Build When a change is pushed to Bitbucket ์„ ์ฒดํฌ ํ•ฉ๋‹ˆ๋‹ค.

(์œ„ ์˜ต์…˜์€ Bitbucket Plugin์„ ์„ค์น˜ํ•˜๋ฉด ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.)

์ถœ์ฒ˜: http://simsi6.tistory.com/14 [๊ณฐ๋Œํ‘ธ์šฐ]