젠킨스 workspace clean-up 설정 변경 (feat. 난 clean-up을 원치 않아!)
현상
-
젠킨스는 한달을 주기로 오래된 Job에 대해서 workspace를 wipe out 적용하여 workspace 내의 빌드 폴더 내부 내용을 삭제함
-
이는 오래된 build의 경우, 젠킨스 내부에서 build별 clean-up 시기를 파악한 후 한달 주기로 관리함으로서 불필요한 리소스를 제거하기 위함
-
젠킨스 시스템 로그를 보면 매일 workspace clean-up이 동작하는 것을 볼 수 있음
Jenkins actually deletes unused ws to keep disk space. Runs by default after 30 days.
문제점
-
젠킨스 workspace 내의 빌드 폴더안에 지워져서는 안되는 파일이 있을 수 있음
-
config라던지 vm환경 내에서 파일을 직접 추가 수정한 경우도 이에 해당함
-
위의 경우, 한달 주기의 workspace clean-up으로 인해 필요한 파일이 삭제되어 장애현상 발생함
해결 방안
-
젠킨스관리 -> 스크립트 콘솔로 들어가 아래 커맨드를 실행 시켜 WorkspaceCleanupThread 가 동작하지 않도록 설정을 바꿔줌
-
command : hudson.model.WorkspaceCleanupThread.disabled=true
- 커맨드에 hudson.model.WorkspaceCleanupThread.disabled 를 쳐서 실행하면 false라고 나와 있을 것 --> default 설정이 그렇게 되어있음
-
아래 그림처럼 명령어를 이용해 변경
상태 확인
젠킨스 workspace clean-up 관련 설정
-
hudson.model.WorkspaceCleanupThread.disabled [ false ] Don't clean up old workspaces on slave nodes
-
hudson.model.WorkspaceCleanupThread.recurrencePeriodHours [ 24 ] How often workspace cleanup should run, in hours.
-
hudson.model.WorkspaceCleanupThread.retainForDays [ 30 ] Unused workspaces are retained for this many days before qualifying for deletion
jenkins workspace 관련 설정 key
https://wiki.jenkins.io/plugins/servlet/mobile?contentId=38929503#content/view/38929503
jenkins workspace 관련 src