--- date: 2025-09-29 author: happybell80 tags: [gitea, actions, cache, deployment] --- # Gitea Actions 캐시로 인한 워크플로우 미반영 문제 ## 문제 상황 - **증상**: 로컬에서 Actions 워크플로우(.gitea/workflows/) 수정 후 push해도 서버에서 이전 워크플로우 실행 - **영향**: docker compose down 제거 등 중요한 수정사항이 반영되지 않음 - **발생 빈도**: 워크플로우 파일 수정 시마다 반복 발생 ## 근본 원인 1. **act runner 캐시 메커니즘** - 실행 위치: `/root/.cache/act/*/hostexecutor/` - 저장소 코드: `/home/admin/ivada_project/` (최신) - Actions 실행: 캐시된 이전 워크플로우 사용 2. **캐시 미갱신** - act runner가 성능 최적화를 위해 워크플로우 캐시 - .gitea/workflows/ 파일 변경 시에도 캐시 자동 갱신 안됨 ## 해결 방법 ### 1. 즉시 해결 (수동) ```bash # Actions 캐시 강제 삭제 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의 캐시 메커니즘 이해 중요