[CI/CD] Git actions 패키지 설치 enoent 오류 해결

eaasurmind·2022년 8월 27일
0
post-thumbnail

  • 2년간 사람 손을 타지 못한 프로젝트를 리뉴얼하여 출시할 일이 생겼습니다.
  • git actions를 통해 브랜치 push가 되면 s3로 들어가고 있었는데 출시 이후 근 2년간은 계속 오류가 나고 있었습니다.
  • 해당 오류는 패키지를 받을 때 생겼는데
  • 최초에 문제라고 판단했던 부분은 private repo로 불러오는 패키지에서 토큰이나 인증 오류라고 생각했었습니다.
    때문에 다음과 같은 코드를 yml파일에 작성하였습니다.
- uses: actions/checkout@v3
      with:
        persist-credentials: false

    - name: Reconfigure git to use HTTP authentication
      run: >
        git config --global url."https://github.com/".insteadOf
        ssh://git@github.com/
    - run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/
    - uses: webfactory/ssh-agent@v0.5.4
      with:
        ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}    
  • 여전히 해결되지 않아서 문제 방향이 캐싱된 패키지들이라고 생각해서 캐시를 비워주었고
		- run: yarn cache clean
    - run: yarn cache clean --mirror
  • 그럼에도 오류가 지속되어
    결과적으로 여러 문서들을 찾아본 결과 yarn install시 리퀘스트 횟수를 제한 걸면 해결이 된다는 의견들이 있어
- name: Install Dependencies
      if: steps.cache.outputs.cache-hit != 'true'    # 의존 파일 설치.
      run: yarn install --network-concurrency 1

해당 코드를 통해 해결이 가능했습니다.

참고
https://community.atlassian.com/t5/Bitbucket-questions/Yarn-install-fails/qaq-p/1555419

profile
You only have to right once

0개의 댓글