我正在通过docker-compose.yml文件运行Buildbot,目前正在尝试使用Buildbot命令行工具通过buildbot sendchange
或buildbot try
来触发我的Github项目的构建(是从Python提交后脚本中使用os.system
调用的。)但是,两者都调用
buildbot try --get-builder-names --connect=pb --master=my.0.0.ip:9984 --username=example-worker --passwd=pass --vc=git
并致电
buildbot sendchange --master my.0.0.ip:9989 --auth me:mypass --who Jimmy --branch=dev
导致twisted.internet.error.TimeoutError,说用户超时导致连接失败。我的构建步骤很简单,很少,并且当我发送任何一个命令时,buildmaster都不会打印任何内容,因此看来我根本没有结束连接(尽管指定的两个端口都在监听)。这可能是有些问题我的配置,但是我不确定。有谁知道如何使这些命令起作用?谢谢!
我的master.cfg的代码段:
# -*- python -*-
# ex: set filetype=python:
import os
from buildbot.plugins import *
c = BuildmasterConfig = {}
####### WORKERS
c['workers'] = [worker.Worker("example-worker", 'pass')]
if 'BUILDBOT_MQ_URL' in os.environ:
c['mq'] = {
'type' : 'wamp',
'router_url': os.environ['BUILDBOT_MQ_URL'],
'realm': os.environ.get('BUILDBOT_MQ_REALM', 'buildbot').decode('utf-8'),
'debug' : 'BUILDBOT_MQ_DEBUG' in os.environ,
'debug_websockets' : 'BUILDBOT_MQ_DEBUG' in os.environ,
'debug_lowlevel' : 'BUILDBOT_MQ_DEBUG' in os.environ,
}
c['protocols'] = {'pb': {'port': os.environ.get("BUILDBOT_WORKER_PORT",9989)}}
####### CHANGESOURCES
c['change_source'] = changes.PBChangeSource(port=9989 , user = 'Jimmy' , passwd = 'secret')
####### SCHEDULERS
c['schedulers'] = []
c['schedulers'].append(schedulers.SingleBranchScheduler(
name="all",
change_filter=util.ChangeFilter(branch='dev'),
treeStableTimer=None,
builderNames=["runtests"]))
c['schedulers'].append(schedulers.ForceScheduler(
name="force",
builderNames=["runtests"]))
c['schedulers'].append(schedulers.Try_Userpass(name="try1",
builderNames=["runtests"],
port=9984,
userpass=[("example-worker","pass")]))
####### BUILDERS
factory = util.BuildFactory()
factory.addStep(steps.ShellCommand(command=["ls" , ".."]))
factory.addStep(steps.ShellCommand(command=["ls"]))
c['builders'] = []
c['builders'].append(
util.BuilderConfig(name="runtests",
workernames=["example-worker"],
factory=factory))
}
我的docker-compose.yml:
version: '2'
services:
buildbot:
image: "buildbot/buildbot-master:master"
env_file:
- db.env
environment:
- BUILDBOT_CONFIG_DIR=config
- BUILDBOT_CONFIG_URL=https://github.com/jimmykim1/learning-buildbot/archive/master.tar.gz
- BUILDBOT_WORKER_PORT=9989
- BUILDBOT_WEB_URL=http://localhost:8010/
- BUILDBOT_WEB_PORT=tcp:port=8010
links:
- db
depends_on:
- db
ports:
- "8010:8010"
- "9989:9989"
- "9984:9984"
db:
env_file:
- db.env
image: "postgres:9.4"
expose:
- 5432
worker:
image: "buildbot/buildbot-worker:master"
environment:
BUILDMASTER: buildbot
BUILDMASTER_PORT: 9989
WORKERNAME: example-worker
WORKERPASS: pass
WORKER_ENVIRONMENT_BLACKLIST: DOCKER_BUILDBOT* BUILDBOT_ENV_* BUILDBOT_1* WORKER_ENVIRONMENT_BLACKLIST
links:
- buildbot