목적
Window에 깔린 Jenkins에서 Mac에있는 Shell script를 실행해야할 필요가 있었습니다. 방법을 찾다보니 저에겐 생소해서 이렇게 글을 적게 되었습니다.
환경
Window10, macOS Catalina 10.15, Jenkins version 2.190.3
Jenkins 설정
SSH Plugin 설치
Credential 추가
저는 이 링크(https://www.thegeekstuff.com/2016/10/jenkins-git-setup/)를 참고하여 추가했습니다.
SSH Server 설정
Mac에 접속하기 위해 SSH(Secure Shell Protocol) Server를 설정합니다. Mac의 IP를 추가하고 포트를 설정합니다.
Project에서 Execute shell script on remote host using ssh 사용
Project에 Execute shell script on remote host using ssh를 추가하고 build script에 실행하고 싶은 Mac의 Shell script 경로를 확인하여 추가합니다. 저는 이 링크(https://yookeun.github.io/tools/2018/04/14/jenkins-remote/)를 참고하여하여 설정했습니다.
주의점
Jenkins Window Shell 문법과 Mac의 ZSH Shell의 문법은 다릅니다. 그리고 Shell script 문법은 아시다 싶이 상당히 엄격하니 대소문자 띄어쓰기 등 문법을 잘 확인하시어 적용하시기 바랍니다.
참고
Jenkins credential - https://jenkins.io/doc/book/using/using-credentials/
