728x90
금일 개발서버 Jenkins에서 작업을 하는데 아래와 같은 문제가 발생하였다
+ ssh user@ip cd /elasticsearch
+ ssh user@ip docker-compose down
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
Build step 'Execute shell' marked build as failure
Finished: FAILURE
문제의 원인은 docker-compose 명령어를 실행하였는데 docker-compose.yml를 못 찾는 에러 였다.
그래서 구글링을 조금 해보았더니 아래 글에서 다음과 같은 이유로 인해 생긴 문제임을 알 수 있었다.
jenkins shell script 에서 발생한 오류들
jenkins를 컨테이너로 돌렸기 때문에 pwd/var/jenkins_home/workspace/a307작업 위치 = 컨테이너 내부가 되므로\-v 옵션으로 호스트경로와 매핑한 것과는 별개로 shell cd 명령어로 바로 호스트 경로로 이동할
velog.io
Execute shell(ssh user@ip 명령어)을 할 때마다 다시 원래 위치(기본 홈디렉토리)로 돌아가버렸기 때문이다.
해결 방법은 간단하다.
하나의 명령어 라인에서 다 처리 해주면 된다.
ssh user@ip """
cd /elasticsearch
docker-compose down
docker-compose up -d
"""
'CI & CD > Jenkins' 카테고리의 다른 글
Jenkins에서 ECS 실행 (0) | 2022.12.09 |
---|---|
Jenkins pipeline을 이용해서 ECR에 Docker Image 업로드 (0) | 2022.12.02 |
Jenkins Pipeline 셋팅하기 (0) | 2022.03.31 |
Mac OS에 Jenkins 설치하기 (0) | 2022.03.04 |