Open linghengqian opened 3 weeks ago
"pollinterval" has been renamed to "pollInterval" See: https://docs.buildbot.net/current/relnotes/3.x.html#deprecations-and-removals
@ThomasDevoogdt
Thanks for the clarification, I realized that the documentation mentioned https://github.com/buildbot/buildbot-docker-example-config/archive/master.tar.gz which is actually outdated.
I noticed that https://docs.buildbot.net/4.0.2/tutorial/firstrun.html suggests manually creating a new file named master.cfg
from master.cfg.sample
.
Buildbot’s activity is controlled by a configuration file. Buildbot by default uses configuration from file at master.cfg, but its installation comes with a sample configuration file named master.cfg.sample. We will use the sample configuration file unchanged, but we have to rename it to master.cfg
And in https://github.com/buildbot/buildbot/blob/v4.0.2/master/buildbot/scripts/create_master.py#L62 , master.cfg.sample
is renamed from sample.cfg
. sample.cfg
is actually https://github.com/buildbot/buildbot/blob/v4.0.2/master/buildbot/scripts/sample.cfg .
def makeSampleConfig(config):
source = util.sibpath(__file__, "sample.cfg")
target = os.path.join(config['basedir'], "master.cfg.sample")
if not config['quiet']:
print(f"creating {target}")
with open(source, "rt", encoding='utf-8') as f:
config_sample = f.read()
if config['db']:
config_sample = config_sample.replace('sqlite:///state.sqlite', config['db'])
with open(target, "wt", encoding='utf-8') as f:
f.write(config_sample)
os.chmod(target, 0o600)
This file needs to be placed in /buildbot/master.cfg
as required by https://github.com/buildbot/buildbot/blob/v4.0.2/master/docker/start_buildbot.sh.
B=$(pwd)
if [ -z "$BUILDBOT_CONFIG_URL" ] then if [ ! -f "$B/master.cfg" ] then echo "No master.cfg found nor \$BUILDBOT_CONFIG_URL!" echo "Please provide a master.cfg file in $B or provide a \$BUILDBOT_CONFIG_URL variable via -e"
- So I changed the `docker-compose.yml` file.
```yaml
services:
db:
image: postgres:16.4-bookworm
environment:
POSTGRES_PASSWORD: change_me
POSTGRES_USER: buildbot
POSTGRES_DB: buildbot
buildbot:
image: buildbot/buildbot-master:v4.0.2
depends_on:
- db
environment:
BUILDBOT_CONFIG_DIR: config
BUILDBOT_WORKER_PORT: 9989
BUILDBOT_WEB_URL: http://localhost:8010/
BUILDBOT_WEB_PORT: tcp:port=8010
BUILDBOT_DB_URL: postgresql+psycopg2://buildbot:change_me@db/buildbot
ports:
- "8010:8010"
volumes:
- ./buildbot-master/master.cfg:/buildbot/master.cfg
worker:
image: buildbot/buildbot-worker:v4.0.2
environment:
BUILDMASTER: buildbot
BUILDMASTER_PORT: 9989
WORKERNAME: example-worker
WORKERPASS: pass
WORKER_ENVIRONMENT_BLACKLIST: DOCKER_BUILDBOT* BUILDBOT_ENV_* BUILDBOT_1* WORKER_ENVIRONMENT_BLACKLIST
./buildbot-master/master.cfg
is as follows.
from buildbot.plugins import *
c = BuildmasterConfig = {}
c['workers'] = [worker.Worker("example-worker", "pass")]
c['protocols'] = {'pb': {'port': 9989}}
c['change_source'] = []
c['change_source'].append(changes.GitPoller(
'https://github.com/buildbot/hello-world.git',
workdir='gitpoller-workdir', branch='master',
pollInterval=300))
c['schedulers'] = []
c['schedulers'].append(schedulers.SingleBranchScheduler(
name="all",
change_filter=util.ChangeFilter(branch='master'),
treeStableTimer=None,
builderNames=["runtests"]))
c['schedulers'].append(schedulers.ForceScheduler(
name="force",
builderNames=["runtests"]))
factory = util.BuildFactory()
factory.addStep(steps.Git(repourl='https://github.com/buildbot/hello-world.git', mode='incremental'))
factory.addStep(steps.ShellCommand(command=["trial", "hello"],
env={"PYTHONPATH": "."}))
c['builders'] = []
c['builders'].append(
util.BuilderConfig(name="runtests",
workernames=["example-worker"],
factory=factory))
c['services'] = []
c['title'] = "Hello World CI"
c['titleURL'] = "https://buildbot.github.io/hello-world/"
c['buildbotURL'] = "http://localhost:8010/"
c['www'] = dict(port=8010,
plugins=dict(waterfall_view={}, console_view={}, grid_view={}))
c['db'] = {
'db_url' : "sqlite:///state.sqlite",
}
http://localhost:8010/
just fine.master.cfg
. This is a bit unintuitive.
docker compose up -d
, I get the following Error Log.