Buildbot: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
No edit summary
No edit summary
Line 158: Line 158:
c['codebaseGenerator'] = codebaseGenerator
c['codebaseGenerator'] = codebaseGenerator
</source>
</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 ===
<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 ===


== References ==
== References ==

Revision as of 23:39, 7 June 2015

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

<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

References

<references />