본문 바로가기
IT Knowledge/Jenkins

MultiBranches Pipeline 설명 및 사용법

by Seok. 2023. 8. 17.
반응형


 

[MulptiBranches Pipeline Project]

프로젝트의 주요기능은 jenkins 자동으로 "소스코드 관리 시스템"에서 jenkins 프로젝트로 인식되는 프로젝트의 브랜치를 관리하고 빌드하는 것이다.

브랜치별로 Job 폴더 프로젝트에 존재한다.

"소스코드 관리 시스템"에서 브랜치가 발생하면, 자동으로 이에 해당하는 jenkins Job 생성된다.

따라서, "소스코드 관리 시스템(GIT)"의 브랜치가 발생하면 자동으로 발견하고 브랜치별로 빌드배포가 가능하다.

 

Branch Sources

Server : Repository

Credentials : SCM 접속 인증정보

Owner : Use the Project Key, not the project name

Repository Name : Project Key 안에 Repository Name

 

 

Behaviours

 - Discover branches : 레포지토리에서 브랜치 발견 방식

    - All branches

    - Only branches that are also filed as PRs / Exclude branches that are also filed as PRs

      (PR : Pull Request)

      리퀘스트를 하면 파이프라인에서 자동 검색

    PR기반 워크플로우를 찾는다면, 해당 옵션이 좋음.

 

 - Discover pull requests from origin : Pull Request 검색 모드

    - Merging the pull request with the current target branch revision : 현재 target branch revision 병합한 결과에 해당하는 pull request 1 발견합니다.

    - the current pull request revision : 병합하지 않고 pull request head revision 경우를 1 발견합니다.

    - Both the current pull request revision and the pull request merged with the current target branch revision : 2가지를 모두 발견 합니다.

 

 - Discover pull requests from forks : forks Pull Request 검색 모드

    - Merging the pull request with the current target branch revision : 현재 target branch revision 병합한 결과에 해당하는 pull request 1 발견합니다.

    - the current pull request revision : 병합하지 않고 pull request head revision 경우를 1 발견합니다.

    - Both the current pull request revision and the pull request merged with the current target branch revision : 2가지를 모두 발견 합니다.

 

 

Property strategy : 설정 전략

    - All branches get the same properties : 모든 브랜치가 같은 설정 사용

    - Named branches get different properties : 이름 있는 브랜치는 다른 설정 사용 - 현재 유일한 설정은 SCM 트리거 무시로 해당 브랜치의 jenkins 커밋 트리거를 무시한다.

 

 

Build Configuration

 - 빌드 설정은 오직 한가지 "By Jenkinsfile"

    - 프로젝트 최상위 경로에 "Jenkinsfile" 이라는 이름을 찾아 자동 빌드한다.

 

Scan Multibranch Pipeline Triggers

 - 기본적으로 일반적인 알람 메커니즘(커밋 트리거등) 동작하지 않을 경우의 예비 대책이다.

 - 새로운 변화를 감지할 최대 대기 시간 동안 자동으로 트리거 하지 않았을때, 기준으로 실행한다.

    : Scan by webhook

 

Orphaned Item Strategy

 - 삭제된 브랜치나 태그들을 파이프라인에서 제거하는 옵션

    - discard old item 특정 기간까지 유지하고 지나면 삭제하는 옵션이다.

      - days to keep old items / Max # of old items to keep : ex) 5일간 유지 삭제.

 

반응형

댓글