본문 바로가기

개발노트

devindabot 구현 및 운용 후기

devindabot이란

dependabot이 레포지토리의 라이브러리를 인식하고 최신버전이 아닐 경우 alert를 낸다.
그 alert를 trigger로 삼아 devin이 dependency의 취약성을 분석한 후, 대응을 한다.(대응은 설정하기 나름)

설정

  1. dependabot을 설정하기 위해 repository에서 settings->code security에 access하여 아래의 Grouped security updates이외의 요소들을 활성화(Enable)한다.

  1. dependabot.yml을 .github디렉토리에 추가한다. 코드는 아래와 같다.(샘플)

# Basic `dependabot.yml` file with
# minimum configuration for three package managers

version: 2
updates:
  # Enable version updates for npm
  - package-ecosystem: "npm"
    # Look for `package.json` and `lock` files in the `root` directory
    directory: "/"
    # Check the npm registry for updates every day (weekdays)
    schedule:
      interval: "daily"

  # Enable version updates for Docker
  - package-ecosystem: "docker"
    # Look for a `Dockerfile` in the `root` directory
    directory: "/"
    # Check for updates once a week
    schedule:
      interval: "weekly"

  # Enable version updates for GitHub Actions
  - package-ecosystem: "github-actions"
    # Workflow files stored in the default location of `.github/workflows`
    # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
    directory: "/"
    schedule:
      interval: "weekly"
  1. devin의 api key를 생성한다.
  2. github action을 사용해서 dependabot의 PR이 open되면 devin의 api가 자동적으로 call되도록 설정한다.(사전에 secrets에 api key를 설정한다.)

devin에게 시킨 대응

  • PR내용을 devin이 분석
  • devin이 web browser에서 dependency에 관한 내용을 조사
  • PR의 commit이력과 코드를 분석
  • 상기한 작동이 끝나면 결과를 comment로 남김
  • 분석한 결과, dependency의 변경이 파괴적인 변경을 초래할 경우, 수정하고 그 수정을 commmit 및 push
  • 분석결과 문제없다면 그대로 merge

느낀점

  • devin의 knowledge, prompt를 개선해나가면 100% devin에게 맡길 수 있다고 생각했다.
    • 구현하면서 작동하지 않은 부분을 직접 명령하면 devin이 수행했기 때문
    • devin에 knowledge가 쌓이면 실수가 줄어든다.(초기의 devin은 팀에 방금 합류한 엔지니어라고 보면 된다.)
  • devin에게 update된 dependency를 반영한 local test를 수행시키기 위해 시행착오가 많았다.
    • devin이 알아서 하겠지, 라고 생각한 부분에서는 어김없이 실수를 해줬기 때문에 정확히 지시를 해줬어야 했다.
      • 현재 개발중인 프로젝트에 대한 이해가 필요하다.
      • devin이 하는 일은 엔지니어가 editor에 코드를 작성하거나 terminal에 cli를 실행하는 것과 같다.
        • 즉, 엔지니어가 뛰어날수록 devin이 더 정확히 작업을 수행하도록 명령을 내릴 수 있다. 엔지니어의 실력이 AI에 반영된다.
  • dependabot의 PR이 open됬을 때 secrets가 안읽혔는데 이는 dependabot의 PR로 trigger된 PR이 fork된 repository로부터 생성된 PR취급을 받기 때문이다.
    • 이 부분은 상정하지 못한 부분이었다.
    • 해결하는데 시간이 꽤 걸렸지만 개발은 역시 경험이 중요하다고 느낄 수 있는 순간이었다.
  • 이번 task를 경험하면서 AI를 통해 나 스스로가 앞으로 어떻게 개발자로 해나가야할 지 정리할 수 있어서 좋았다.

Reference

freee-devindabot
dependabot
dependabot options reference
Dependabot 빠른 시작 가이드
Dependabot버전 업데이트 구성

'개발노트' 카테고리의 다른 글

[Django][AWS] 마이그레이션용 컨테이너 분리  (0) 2023.08.29