준비. 저장소 생성
프로그램소스가 저장될 공간을 bitbucket에 생성합니다.
처음이므로 먼저 프로젝트를 생성합니다.
웹UI 로그인 -> 상단 Projects -> Create project 클릭
- Poject name : sy-project
- Project key : SYP (대문자로 자동생성됩니다.)
Create project 클릭합니다.
repository를 생성합니다. Create repository 클릭
- Name : sy-repo
- Default branch name : main
Create repository 클릭합니다.
아래 화면이 나오면 성공입니다.
준비. 저장소로 push
테스트로 파일하나 생성하고 저장소로 git push 해봅니다.
PS C:\Users\ky945> cd SYprj
PS C:\Users\ky945\SYprj> notepad sytest.txt
this is CI/CD test file
PS C:\Users\ky945\SYprj> ls
Directory: C:\Users\ky945\SYprj
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2025-04-20 오후 5:00 23 sytest.txt
PS C:\Users\ky945\SYprj> git init
Initialized empty Git repository in C:/Users/ky945/SYprj/.git/
PS C:\Users\ky945\SYprj> git add --all
PS C:\Users\ky945\SYprj> git commit -m "Initial Commit SY"
[master (root-commit) 7e99962] Initial Commit SY
1 file changed, 1 insertion(+)
create mode 100644 sytest.txt
PS C:\Users\ky945\SYprj> git remote add origin https://bitb.sytech.store/scm/syp/sy-repo.git
PS C:\Users\ky945\SYprj> git push -u origin HEAD:main
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
git: 'credential-manager-core' is not a git command. See 'git --help'.
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 240 bytes | 240.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://bitb.sytech.store/scm/syp/sy-repo.git
* [new branch] HEAD -> main
branch 'master' set up to track 'origin/main'.
참고. 진행중에 아래 팝업창이 나오면 "Password/Token" 선택하고 username 과 password 입력합니다.
준비. 서버생성
빌드는 Bamboo 로컬에서 가능하고, 원격서버에도 가능합니다. 여기서는 로컬에서 빌드하는걸로 하겠습니다.
배포는 원격서버에 합니다. 도커 컨테이너로 배포 대상서버(ubuntu)를 설치합니다.
PS C:\Users\ky945\SYubuntu> notepad Dockerfile
# Dockerfile
FROM ubuntu:latest
# 원격에서 ssh 접속할 수 있게 ssh서버를 설치합니다.
RUN apt-get update && \
apt-get install -y openssh-server && \
mkdir /var/run/sshd
# root 비밀번호 설정 (예: root:root)
RUN echo 'root:root' | chpasswd
# SSH 접속 시 필요한 설정
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
PS C:\Users\ky945\SYubuntu> docker build -t syubuntu .
# 도커 이미지를 빌드합니다.
PS C:\Users\ky945\SYubuntu> docker run -d -p 22:22 --name sy-ubuntu syubuntu
ea42aedd7c456efe56702fdc68ac662e84fb156951b29ed13527ff6671395b3e
# 컨테이너로 기동합니다.
PS C:\Users\ky945\SYubuntu> ssh root@localhost
The authenticity of host 'localhost (::1)' can't be established.
ED25519 key fingerprint is SHA256:7tPmV3s741qVSZvEfDmpqKV/FiCeYL7gmZI1pWqyJno.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'localhost' (ED25519) to the list of known hosts.
root@localhost's password:
root@ea42aedd7c45:~#
# 컨테이너로 ssh접속이 정상입니다.
준비를 끝내고 plan 생성을 시작합니다.
- Project name : sy-bam-project
- Project key : SYB (자동입력됨)
- Project description : sy bamboo project
- Plan name : sy-bam-plan
- Plan key : SYB (자동입력됨)
- Plan description : sy bamboo plan
Create 클릭!
- Repository host : Link new repository -> Bitbucket DC/Server 선택
"Link Bamboo to Bitbucket Server" 클릭!
Create link 클릭!
- Application URL : https://bitb.sytech.store (bitbucket 설치한 URL주소입력)
continue 클릭!
주의! 그전에 bitbucket에 로그인해 있어야합니다. 그렇지않으면 Link 생성이 안됩니다. 버그인듯...
bitbucket가 서로 통신이 가능한것을 확인합니다. continue 클릭!
bitbucket 사이트로 redirect 되고, bamboo 와 연결이 정상인것을 확인합니다. continue 클릭!
bamboo 주소로 redirect 됩니다. Status가 "CONNECTED" 보이면 성공입니다.
설치진행 페이지로 다 돌아옵니다.
- Display name : sy-bam-display (적당한 이름 입력)
"Login & approve" 클릭 !
Bamboo에서 접근하는걸 허락합니다. Allow 클릭!
주의! bitbucket에서 ssh 서비스를 외부로 노출해야합니다. bamboo가 빌드에 필요한 소스저장소를 ssh로 접근합니다. 다음처럼 설정하고 적용합니다.
PS C:\Users\ky945\SYk8s> notepad bitbucket-values.yaml
bitbucket:
sshService:
enabled: true # false 를 true로 변경합니다.
port: 7999 # 기본포트 7999로 입력합니다.
PS C:\Users\ky945\SYk8s> helm upgrade --install sy-bitb syrepo-bitbucket/bitbucket `
--namespace syns-bitb `
--set fullnameOverride=sybitb `
-f bitbucket-values.yaml
# bitbucket-values.yaml 내용을 변경하고, 적용합니다.
PS C:\Users\ky945\SYk8s> k get svc -n syns-bitb
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
sybitb ClusterIP 10.99.51.156 <none> 80/TCP,7999/TCP,5701/TCP 2d19h
sybitb-ssh LoadBalancer 10.102.95.203 localhost 7999:32542/TCP 2d
# sybitb-ssh 서비스가 생성되었고, 7999 포트로 외부노출이 된것이 확인됩니다.
계속진행합니다.
- Repository : sy-project / sy-repo 선택
- Branch : main 선택
"Save and continue" 클릭!
'쿠버네티스 환경' 카테고리의 다른 글
Bamboo 설치 (0) | 2025.04.13 |
---|---|
Bitbucket 설치 (0) | 2025.04.09 |
인그레스 컨트롤러 설치 (0) | 2025.04.05 |
helm 설치 (0) | 2025.04.05 |
공인인증서 만들기 (0) | 2025.04.04 |