Jenkins build configuration

Ryu·2022년 5월 3일
0

2019-archive

목록 보기
2/3

2019년에 작성한 노트를 옮겨 적은 것입니다.

Pull Request가 올라올 때 빌드하기

  • Bitbutcket에서 프로젝트에 풀리퀘스트가 올라오는 경우 Jenkins가 해당 commit으로 빌드 및 테스트 진행하여 결과를 알려줌.
  • 이를 위해선 Bitbucket과 Jenkins 두 군데에서의 설정 필요.

How to setup Bitbucket

  • Bitbucket > Settings > WORKFLOW > Hooks : 이 곳에서 여러가지 Bitbucket 플러그인 설정 가능
  • Bitbucket Server Webhook to Jenkins 설정

How to setup Jenkins Project

  • Jenkins > foo-project > Configure

Source Code management

  • Git 프로젝트 설정. Branch는 any - 모든 브랜치의 변경사항 가져옴

Build Triggers

  • Stash Pull Requests Builder 설정
  • Advanced에서 특정 브랜치 설정하지 않도록 -
    CI Build Phrases에 설정한 phrase를 Bitbucket pull request에 코멘트로 달면 젠킨스 빌드 trigger됨

Build

Post Build Actions

  • Add 'Notify Bitbucket Instance'
  • Then, you will see the build status from the Bitbucket Pull Request page
  • Bitbucket에서 Builds 아이콘 생성 확인
  • Add Pull Request Builder - Post Build Comment
  • Comment when build was successful & Comment when build failed 빈칸으로. Plain text다는 경우 코멘트 안달림

Daily quality report

  • Develop가 생성한 Test report로 이메일을 구성하여 보내는 역할

Quality Report

  • Develop가 빌드할 때마다 빌드 됨.
  • nyc로 생성한 테스트 리포트로 리소스 파일 빌드 후
    /var/www/html/qualityquality.html 생성

Daily Quality Report

  • 매일 오전 8시에 /var/www/html/quality/quality.html의 내용을 foo@bar.com으로 메일링
  • Post-build Actions > Editable Email Notification 설정
    • E-mail Notification plugin과는 다르게 custom mail을 보내는 용도
  • Project Recipient List
    • SMTP 서버에서 식별 가능한 메일주소만 보낼 수 있음 (Details in the next item)

How to set SMTP

  • Jenkins > Manage Jenkins > Configure System > E-mail Notification or Extended E-mail Notification
    • SMTP server: email-smtp.us-east-1.amazonaws.com
  • 현재 Amazon SES 사용중
  • Advanced
    • Use SMTP Authentication 설정
    • Username/Password 모름 (물어봐야 할듯)
  • Jenkins의 이메일 기능에 Recipient 추가하려면 AWS SES에 등록이 되어있어야 함
  • AWS에서 등록되지 않은 이메일을 Jenkins에 설정하면 빌드 실패

0개의 댓글