diff --git a/troubleshooting/250929_actions_cache_problem.md b/troubleshooting/250929_actions_cache_problem.md index 6dd6752..0b58905 100644 --- a/troubleshooting/250929_actions_cache_problem.md +++ b/troubleshooting/250929_actions_cache_problem.md @@ -22,15 +22,38 @@ tags: [gitea, actions, cache, deployment] - .gitea/workflows/ 파일 변경 시에도 캐시 자동 갱신 안됨 ## 해결 방법 + +### 1. 즉시 해결 (수동) ```bash # Actions 캐시 강제 삭제 sudo rm -rf /root/.cache/act/ - -# 또는 특정 프로젝트만 -sudo rm -rf /root/.cache/act/*/프로젝트명/ ``` +### 2. 자동화된 해결책 (구현됨) +- **파일**: `/home/admin/scripts/cleanup-server.sh` (line 66-75) +- **스케줄**: crontab `0 4 * * * /home/admin/scripts/cleanup-server.sh` +- **로그**: `/mnt/hdd/logs/cleanup/cleanup-YYYYMMDD.log` +- **대상**: `/root/.cache/act` 디렉토리의 7일 이상 된 하위 디렉토리들 + +```bash +# 7. Actions 캐시 정리 (7일 이상 된 것) +echo "$(date '+%Y-%m-%d %H:%M:%S') - Actions 캐시 정리 중..." >> $LOG_FILE +if [ -d "/root/.cache/act" ]; then + ACT_CACHE_BEFORE=$(find /root/.cache/act -type d 2>/dev/null | wc -l) + find /root/.cache/act -type d -mtime +7 -exec rm -rf {} + 2>/dev/null + ACT_CACHE_AFTER=$(find /root/.cache/act -type d 2>/dev/null | wc -l) + echo "$(date '+%Y-%m-%d %H:%M:%S') - Actions 캐시 디렉토리: $ACT_CACHE_BEFORE -> $ACT_CACHE_AFTER" >> $LOG_FILE +else + echo "$(date '+%Y-%m-%d %H:%M:%S') - Actions 캐시 디렉토리 없음" >> $LOG_FILE +fi +``` + +## 해결 결과 (2025-09-29) +✅ **캐시 수동 삭제**: `/root/.cache/act/` 삭제로 즉시 문제 해결 +✅ **자동화 구현**: cleanup-server.sh에 캐시 정리 로직 추가 +✅ **향후 방지**: 매일 자동으로 오래된 캐시 정리하여 재발 방지 + ## 교훈 - Gitea Actions 워크플로우 수정 후 반영 안되면 act runner 캐시 확인 필수 -- 중요한 워크플로우 변경 시 캐시 삭제 후 재실행 -- 향후 act runner 업데이트로 개선 기대 \ No newline at end of file +- 캐시 문제는 자동화된 정리로 예방 가능 +- act runner의 캐시 메커니즘 이해 중요 \ No newline at end of file