Buildbot

From 탱이의 잡동사니
Jump to navigation Jump to search

Overview

Buildbot 사용법 설명. 원문은 이곳<ref>http://docs.buildbot.net/current/manual/configuration.html</ref>에서 확인할 수 있다.

Configuring Buildbot

Testing the config file

다음의 명령어로 설정한 master.cfg 파일의 유효성 여부를 체크할 수 있다.

$ buildbot checkconfig master.cfg
Config file is good!

-- or

$ buildbot checkconfig /tmp/masterdir
Config file is good!

Reloading the config file(reconfig)

만약 config 파일 설정 후, 다시 재로딩을 한다면 다음의 명령어를 입력하면 된다.

$ buildbot reconfig BASEDIR

Global Configuration

Dtabase Specification

Buildbot 은 상태 정보(컴파일/빌드 진행 상황)를 유지하기 위해 Database 연결을 필요로 한다. <source lang=python> c['db'] = {

   'db_url': 'sqlite:///state.sqlite',
   'db_poll_interval': 30

} </source>

Multi-master mode

Site Definitions

Buildmaster 관련한 3 가지 주요 설정이 있다. <source lang=python> c['title'] = "Buildbot" c['titleURL'] = "http://buildbot.sourceforge.net/" c['buildbotURL'] = "http://localhost:8010/" </source>

  • title 은 buildbot 웹 페이시 화면상에 나타나는 제목을 나타낸다.
  • titleURL 은 반드시 (/)슬래쉬로 끝나야 한다. title 클릭시 이동되는 사이트 주소를 의미한다.
  • buildbotURL' 은 반드시 (/)슬래쉬로 끝나야 한다. buldbot 웹 서버의 주소를 나타낸다.

Log Handling

<source lang=python> c['logCompressionLimit'] = 16384 c['logCompressionMethod'] = 'gz' c['logMaxSize'] = 1024*1024 # 1M c['logMaxTailSize'] = 32768 </source>

Data Lifetime

Horizons

<source lang=python> c['changeHorizon'] = 200 c['buildHorizon'] = 100 c['eventHorizon'] = 50 c['logHorizon'] = 40 c['buildCacheSize'] = 15 </source>

Caches

<source lang=python> c['caches'] = {

   'Changes' : 100,     # formerly c['changeCacheSize']
   'Builds' : 500,      # formerly c['buildCacheSize']
   'chdicts' : 100,
   'BuildRequests' : 10,
   'SourceStamps' : 20,
   'ssdicts' : 20,
   'objectids' : 10,
   'usdicts' : 100,

} </source>

Merging Build Requests

<source lang=python> c['mergeRequests'] = True </source>

Prioritizing Builders

<source lang=python> def prioritizeBuilders(buildmaster, builders):

   ...

c['prioritizeBuilders'] = prioritizeBuilders </source>

Setting the PB Port for Slaves

<source lang=python> c['protocols'] = {"pb": {"port": 10000}} </source>

Defining Global Properties

<source lang=python> c['properties'] = {

   'Widget-version' : '1.2',
   'release-stage' : 'alpha'

} </source>

Debug Options

Manhole

Metrics Options

<source lang=python> c['metrics'] = dict(log_interval=10, periodic_interval=10) </source>

Users Options

<source lang=python> from buildbot.plugins import util

c['user_managers'] = [] c['user_managers'].append(util.CommandlineUserManager(username="user",

                                                     passwd="userpw",
                                                     port=9990))

</source>

Input Validation

<source lang=python> import re c['validation'] = {

   'branch': re.compile(r'^[\w.+/~-]*$'),
   'revision': re.compile(r'^[ \w\.\-\/]*$'),
   'property_name': re.compile(r'^[\w\.\-\/\~:]*$'),
   'property_value': re.compile(r'^[\w\.\-\/\~:]*$'),

} </source>

Revision Links

Revision Link Helpers

<source lang=python> from buildbot.plugins import util

c['revlink'] = util.RevlinkMatch([r'git://notmuchmail.org/git/(.*)'],

                                r'http://git.notmuchmail.org/git/\1/commit/%s')

</source>

Codebase Generator

<source lang=python> all_repositories = {

   r'https://hg/hg/mailsuite/mailclient': 'mailexe',
   r'https://hg/hg/mailsuite/mapilib': 'mapilib',
   r'https://hg/hg/mailsuite/imaplib': 'imaplib',
   r'https://github.com/mailinc/mailsuite/mailclient': 'mailexe',
   r'https://github.com/mailinc/mailsuite/mapilib': 'mapilib',
   r'https://github.com/mailinc/mailsuite/imaplib': 'imaplib',

}

def codebaseGenerator(chdict):

   return all_repositories[chdict['repository']]

c['codebaseGenerator'] = codebaseGenerator </source>

Change Sources

Choosing a Change Source

Configuring Change Sources

change_source 키에 현재 작동하는 소스 설정을 저장한다.

참조하는 ChangeSource가 하나 뿐이라면, 아래와 같이 설정한다. <source lang=python> from buildbot.plugins import changes

c['change_source'] = changes.PBChangeSource() </source>

두 개 이상이라면, 아래와 같이 설정한다. <source lang=python> source1 = ... source2 = ... c['change_source'] = [source1, source1] </source>

Repository and Project

Mail-parsing ChangeSources

<source lang=python> from buildbot.plugins import changes

c['change_source'] = changes.CVSMaildirSource("~/maildir-buildbot",

                                             prefix="/trunk/")

</source>

Subscribing the Buildmaster

Using Maildirs

Parsing Email Change Messages

CVSMaildirSource

SVNCommitEmailMaildirSource

BzrLaunchpadEmailMaildirSource

PBChangeSource

Bzr Hook

P4Source

Example

BonsaiPller

SVNPoller

BzrPoller

GitPoller

  • repourl
git repository url 을 지정한다. git@example.com:foobaz/myrepo.git 과 같은 방식으로 지정한다.
  • branches
다음 중 하나를 지정할 수 있다.
- a list of the branches to fetch.
- True indicating that all branches should be fetched
- a callable which takes a single argument. It should take a remote refspec (such as 'refs/heads/master', and return a boolean indicating whether that branch should be fetched.
  • branch
accepts a single branch name to fetch. Exists for backwards compatibility with old configurations.
  • pollInterval
Polling 주기를 설정한다. 기본값은 10분이다.(단위:Sec)
  • pollAtLaunch
최초 Polling 시기를 지정한다. True = 시작과 동시에 Poll, False = 지정한 PollInterval 시간 후에 최초 Poll 을 한다.(기본값)
  • gitbin
git 바이너리 파일의 위치를 지정한다. 기본값은 'git'이다.
  • category
  • project
  • usetimestamps
  • encoding
  • workdir

<source lang=python> from buildbot.plugins import changes

c['change_source'] = changes.GitPoller(repourl='git@example.com:foobaz/myrepo.git',

                                      branches=['master', 'great_new_feature'])

</source>

HgPoller

BitbucketPullrequestPoller

GerritChangeSource

GerritChangeFilter

Change Hooks (HTTP Notifications)

GoogleCodeAtomPoller

Buildslaves

Defining Buildslaves

BuildSlave 인스턴스 생성시, slavename 과 slavepasswd 를 지정해야 한다. 여기에 지정하는 slavename 과 slavepasswd 는 반드시 builslave 생성시 지정한 값과 같아야 한다. slavename 은 반드시 유일한 값이어야 하며, password 값은 보안을 위해 신경써서 지정하도록 하자.

2 개의 slave 를 생성하는 예제이다. <source lang=python> from buildbot.plugins import buildslave

c['slaves'] = [

   buildslave.BuildSlave('bot-solaris', 'solarispasswd'),
   buildslave.BuildSlave('bot-bsd', 'bsdpasswd'),

] </source>

BuildSlave Options

References

<references />