continuous integration part 2 continuous...
TRANSCRIPT
Continuous Integration Part 2
Continuous Integration Servers
조영호
카페PJT팀
2008.09.01
1. Continuous Integration Servers
2. CruiseControl
3. Bamboo
목차
1. Continuous Integration Severs
4 / 문서의 제목
CI 서버 목록
http://confluence.public.thoughtworks.org/display/CC/CI+Feature+Matrix
5 / 문서의 제목
CI 서버 목록
6 / 문서의 제목
CI 시스템 구성
개발자
서브버전
개발자
개발자
피드백 메커니즘
빌드 스크립트
지속적인 통합 서버
통합 빌드 머신버전 관리 저장소
변경 사항커밋하기 폴링
소스 코드 컴파일 하기,데이터베이스 통합하기,테스트 돌리기,검사 돌리기,소프트웨어 배포하기
피드백 생성하기피드백
7 / 문서의 제목
개발자
서브버전
개발자
개발자
피드백 메커니즘
빌드 스크립트
지속적인 통합 서버
통합 빌드 머신버전 관리 저장소
변경 사항커밋하기 폴링
소스 코드 컴파일 하기,데이터베이스 통합하기,테스트 돌리기,검사 돌리기,소프트웨어 배포하기
피드백 생성하기피드백
폴링
CI 시스템 설정
Subversion 소스 위치
Polling Frequency 폴링 주기
Quiet Period commit 완료 확인 주기
Maven2 POM 빌드 스크립트
Feedback 메일 주소
8 / 문서의 제목
Maven2 PMD Plugin 추가
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<minimumTokens>40</minimumTokens>
<targetJdk>1.5</targetJdk>
<outputDirectory>
${project.reporting.outputDirectory}/pmd
</outputDirectory>
<targetDirectory>
${project.reporting.outputDirectory}/pmd
</targetDirectory>
</configuration>
</plugin>
pom.xml
2. CruiseControl
10 / 문서의 제목
CruiseControl
특징
오픈 소스
가장 널리 사용되는 CI
배포자
ThoughtWorks
http://cruisecontrol.sourceforge.net
플랫폼
자바2
빌드 도구
Ant, Maven, Maven2, NAnt
버전 관리 시스템
Subversion, ClearCase, CM Synergy, CVS, MKS, Perforce, PVCS,
SnapshotCM, StarTeam, Surround SCM, Visual SourceSafe
11 / 문서의 제목
빌드 디렉터리 준비
checkout/
cafe-main/
logs/
artifacts/
cc-config.xml
config.xml
builds/artifacts
빌드 산출물 저장
checkout
프로젝트 체크 아웃
logs
빌드 로그 저장
cc-config.xml
위임 빌드 스크립트
config.xml
CruiseControl 설정 파일
12 / 문서의 제목
위임 빌드 파일 작성
cc-config.xml
• 마지막 빌드 디렉토리 삭제
• Subversion에서 현재 프로젝트 체크아웃
• 빌드 실행
아무것도 없는 상태에서 만든 빌드가 성공적으로 실행된다면,
그 빌드가 완전(Complete)하다는 것을 더 확실하게 믿을 수 있다.
13 / 문서의 제목
위임 빌드 파일 작성
<?xml version="1.0"?>
<project name="credit-card" default="prepare" basedir="checkout">
<property name="build-dir" location="cafe-main"/>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml"
classpath="svnant.jar" />
<target name="prepare">
<delete dir="${build-dir}"/>
<svn>
<checkout
url=" http://svn.bds.nhncorp.com/cafe/main/branches/CI-BRANCH"
destPath="${build-dir}"/>
</svn>
</target>
</project>
cc-config.xml
ant –buildfile cc-config.xml
14 / 문서의 제목
config.xml
• 프로젝트 정의
• 빌드 부트스트랩(bootstrap)
• Subversion 변환 확인
• 빌드 시간 간격 설정
• 로그 저장
• 빌드 결과 발표
빌드 프로세스 설정
15 / 문서의 제목
<?xml version="1.0" encoding="UTF-8"?>
<cruisecontrol>
<property environment="env"/>
<property name="build-dir" value="checkout/cafe-main"/>
<project name="cafe-main" buildafterfailed="false">
빌드 프로세스 설정
프로젝트
정의
<bootstrappers>
<currentbuildstatusbootstrapper
file="logs/cafe-main/currentbuildstatus.txt" />
</bootstrappers>
<modificationset quietperiod="10">
<svn localworkingcopy="checkout/cafe-main" />
</modificationset>
빌드
부트스트랩
Subversion
변화 확인
config.xml
Subversion Repository와checkout/cafe-bridge 비교
Subversion Repository에 10초 동안
변경이 없으면 빌드 시작
16 / 문서의 제목
config.xml
빌드 프로세스 설정
빌드 시간
간격 정의
로그 저장
<schedule interval="30">
<composite>
<ant anthome="C:\CC-BUILD\tools\apache-ant-1.7.0"
buildfile="cc-config.xml" target="prepare" />
<maven2 mvnhome="${env.M2_HOME}"
pomfile="${build-dir}/pom.xml"
goal="clean package war:inplace pmd:cpd"/>
</composite>
</schedule>
<log dir="logs/cafe-main">
<merge dir="${build-dir}/target/surefire-reports" />
</log>
30초 간격으로 Subversion 체크
cc-config.xml 실행
Maven Build 실행
Test 결과를 log 파일에 머지
17 / 문서의 제목
config.xml
빌드 프로세스 설정
빌드 결과
발표
<publishers>
<currentbuildstatuspublisher
file="logs/cafeb-main/currentbuildstatus.txt" />
<artifactspublisher
dir="${build-dir}/target/site"
dest="artifacts/cafe-main"/>
<htmlemail mailhost="127.0.0.1"
returnaddress=" [email protected]"
defaultsuffix="@nhncorp.com"
buildresultsurl="http://127.0.0.1:8010/cruisecontrol"
css="C:/Dev/installed/cruisecontrol-bin-2.7.2
/webapps/cruisecontrol/css/cruisecontrol.css"
xsldir="C:/Dev/installed/cruisecontrol-bin-2.7.2/webapps
/cruisecontrol/xsl"
logdir="logs/credit-account">
<map alias="youngho" address="[email protected]"/>
<failure address="youngho" reportWhenFixed="true"/>
</htmlemail>
</publishers>
</project>
</cruisecontrol>
Artifact를 artifacts 디렉토리로 복사
e-mail 통지
20 / 문서의 제목
3. Bamboo
21 / 문서의 제목
Bamboo
특징
상업용 CI 서버
빌드 메트릭과 사용하기 편한 UI, JIRA 통합 지원
배포자
atlassian
http://www.atlassian.com/software/bamboo
플랫폼
자바2
빌드 도구
Ant, Maven, Maven2, NAnt
버전 관리 시스템
Subversion, ClearCase, CVS, Mercurial, Perfoce, PVCS,
StarTeam, SCM filtering, Multi-SCM
22 / 문서의 제목
Launch Bamboo
Windows
BambooConsole.bat – Windows 콘솔에서 Bamboo 실행
InstallAsService.bat - Bamboo를 Windows 서비스로 등록
StartBamboo.bat – Windows 서비스로 등록된 Bamboo 실행
StopBamboo.bat – Windows 서비스로 등록된 Bamboo 종료
UninstallService.bat - Windows 서비스에서 Bamboo 제거
Linux
bamboo.sh start - Bamboo 실행
bamboo.sh stop – Bamboo 종료
bamboo.sh restart – Bamboo 재실행
bamboo.sh status – Bamboo의 현재 상태 보고
23 / 문서의 제목
Installation Setting
http://127.0.0.1:8085
Configuration Directory
Bamboo 설정 파일 저장
Build Data Directory
프로젝트 데이터 파일 저장
Build Working Directory
소스 파일 체크 아웃
24 / 문서의 제목
Database
25 / 문서의 제목
Starting Data
Create new Bamboo home
일반 설치/업그레이드
Import existing data
설치된 Bamboo를 다른 서버로이관시킬 경우
26 / 문서의 제목
Bamboo Administrator
27 / 문서의 제목
Server Configuration
28 / 문서의 제목
Builder & JDK Setting
29 / 문서의 제목
Bamboo PMD Plugin
Plugin 설치
PMD Plugin jar 복사
<BAMBOO_HOME>/webapp/WEB-INF/lib
Bamboo restart
pmd_bamboo-2.0.3.jar
30 / 문서의 제목
Project
Plan
Build
Project, Plan, Build
• 서로 연관된 Plan들의 그룹
• Name과 Key로 구성
• Name – Cafe Bridge
• Key - BRIDGE
• 빌드에 필요한 재료 집합
• 프로젝트 별 브랜치와 대응
• Name과 Key로 구성
• Name – CI-BRANCH
• Key - CITEST
• Plan의 실행
• 빌드 번호를 가짐
BUILD NUMBER = [PROJECT-KEY]-[PLAN-KEY]-[NUMBER]
31 / 문서의 제목
Create Plan
PROJECT NAME PLAN NAME [PROJECT-KEY]-[PLAN-KEY]-[NUMBER]
32 / 문서의 제목
Plan Details
33 / 문서의 제목
Source Repository
34 / 문서의 제목
Source Repository
Quiet Period
Subversion 변경 체크 주기
Maximum Retries
빌드 시작 전에 Quiet Period를 사용하여 체크할
횟수
35 / 문서의 제목
Source Repository
36 / 문서의 제목
Builder
Builder & Goal
Maven goal 설정
PMD 출력 디렉토리 설정
PMD Plugin 설치 후 표시
37 / 문서의 제목
Specify Requirements
38 / 문서의 제목
Plan’s Build Artifacts
39 / 문서의 제목
Plan’s Notification
Feedback
빌드 결과를 e-mail로 통지
40 / 문서의 제목
Post Action
주기적인 빌드 결과 또는Artifacts 정리 작업 등록
41 / 문서의 제목
Plan Permission
Thank you.
Question.