Add SSH Agent
SSH Key 생성하기
$ mkdir ~/.ssh && chmod 700 ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "JenkinsAgentRSA" -f "jenkinsAgent_rsa"
$ ls
jenkinsAgent_rsa jenkinsAgent_rsa.pub
-
이 키는 한번 만들어두면 여러 agent 서버에 사용할 수 있다.
Worker 서버에 공개키 등록하기(Agent)
$ cat jenkinsAgent_rsa.pub >> ~/.ssh/authorized_keys
Manager에 비밀키 등록하기(Jenkins)
-
plugin 설치: SSH Build Agents
-
credentials 생성
-
Add Credentials
로 추가-
Username: 접속하고자 하는 서버의 계정
-
Private Key: 서버에서 생성한 private key
-
Passphrase: ssh key 생성시 입력한 passphrase
-
-
SSH Agent 추가하기
-
# of executors
갯수는 전체 코어 갯수보다 적게 설정해야 한다. →lscpu
명령어로 cpu 정보 확인 가능
https://stackoverflow.com/a/9626974/3793078 -
Host Key Verification Strategy
값은Manually trusted key Verification Strategy
로 설정해줘야 한다. -
launcher agent로 설치
Troubleshooting
Failed to create parent directories for tracking file
[WARNING] Failed to write tracking file /home/user/.m2/repository/...
-
원인: 빌드가 동작하는 노드가 예전에 docker로 jenkins를 띄웠었는데, 그 때 m2 디렉토리 권한을 root로 변경시킴
-
해결방법:
$ chown -R user:user ~/.m2
도커 worker(aka. agent, node) 설치시 workser 서버에 yum 업데이트할 때 커널 제외하기 * https://www.cyberciti.biz/faq/yum-update-except-kernel-package-command/