Jenkins with Bitbucket

NOWNIZยท2023๋…„ 1์›” 26์ผ
0

Blah Blah

๋ชฉ๋ก ๋ณด๊ธฐ
3/9

๐Ÿš€ Jenkins(์  ํ‚จ์Šค)์™€ BitBucket(๋น—๋ฒ„ํ‚ท)์„ ์—ฐ๋™ํ•ด๋ณด๊ธฐ

๊ฐœ์š”

  • Jenkins Pipeline์—์„œ git module์„ ํ†ตํ•ด Bitbucket repository์— ์ ‘๊ทผํ•˜์—ฌ ์†Œ์Šค๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค.

1. ํ‚ค ๋ฐœ๊ธ‰

๋ฆฌ๋ˆ…์Šค ์„œ๋ฒ„์—์„œ key file์„ ์ƒ์„ฑํ•ด๋„ ๋œ๋‹ค. ํ•˜์ง€๋งŒ.. ๊ท€์ฐฎ์•„์„œ AWS Key Pairs๋ฅผ ์ด์šฉํ–ˆ๋‹ค.

jenkins-bitbucket.pem

-----BEGIN RSA PRIVATE KEY-----
~~~
-----END RSA PRIVATE KEY-----

Key Pairs์—์„œ ๋ฐœ๊ธ‰ํ•œ key๋Š” private key์ด๋‹ค.

Bitbucket์— ๋“ฑ๋ก์„ ํ•ด์•ผํ•  public key๊ฐ€ ํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์— puttygen์„ ์ด์šฉํ•œ๋‹ค.

File โ†’ Load Private Key โ†’ ์ƒ์„ฑํ•œ private key ์„ ํƒ โ†’ Save public key ์„ ํƒ โ†’ ์ €์žฅํ•  ์œ„์น˜ ํ™•์ธ

jenkins-bitbucket_public.ppk

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "imported-openssh-key"
~~~
---- END SSH2 PUBLIC KEY ----

2. ํ‚ค ๋“ฑ๋ก

Bitbucket

Bitbucket โ†’ Workspace setting โ†’ Security โ†’ SSH Keys ์— public key๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. (๋น—๋ฒ„ํ‚ท ๊ด€๋ฆฌ์ž)

Jenkins

  1. Jenkins ๊ด€๋ฆฌ โ†’ Security - Manage Credentials ์ด๋™
  2. global ์„ ํƒ

  1. Add Credentials ์„ ํƒ

  1. ๋‚ด์šฉ ๊ธฐ์ž…

  1. ๋“ฑ๋ก ์™„๋ฃŒ

3. ํ‚ค ์‚ฌ์šฉ

job configuration

profile
DevOps & Cloud Engineering

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