Skip to content

Commit 8d1c0ed

Browse files
committed
master-nonlatent move to common class
1 parent 1d6c724 commit 8d1c0ed

File tree

1 file changed

+98
-134
lines changed

1 file changed

+98
-134
lines changed

master-nonlatent/master.cfg

Lines changed: 98 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,53 @@
11
# -*- python -*-
22
# ex: set filetype=python:
33

4-
from buildbot.plugins import *
5-
from buildbot.process.properties import Property, Properties
6-
from buildbot.steps.shell import ShellCommand, Compile, Test, SetPropertyFromCommand
7-
from buildbot.steps.mtrlogobserver import MTR, MtrLogObserver
8-
from buildbot.steps.source.github import GitHub
9-
from buildbot.process.remotecommand import RemoteCommand
10-
from datetime import timedelta
11-
from twisted.internet import defer
12-
13-
import docker
144
import os
15-
import sys
16-
17-
sys.setrecursionlimit(10000)
5+
from datetime import timedelta
186

19-
sys.path.insert(0, "/srv/buildbot/master")
20-
from common_factories import *
21-
from locks import *
22-
from schedulers_definition import SCHEDULERS
23-
from utils import *
7+
from buildbot.plugins import steps, util, worker
8+
from buildbot.process.properties import Property
9+
from common_factories import addWinTests, getQuickBuildFactory
10+
from constants import MTR_ENV, SAVED_PACKAGE_BRANCHES
11+
from master_common import base_master_config
12+
from utils import (
13+
canStartBuild,
14+
createVar,
15+
getHTMLLogString,
16+
getSourceTarball,
17+
hasFailed,
18+
ls2list,
19+
moveMTRLogs,
20+
mtrJobsMultiplier,
21+
nextBuild,
22+
prioritizeBuilders,
23+
savePackage,
24+
)
2425

2526
####### VARIABLES
2627
vsWarningPattern = "^.*: warning C.*$"
2728

28-
# This is the dictionary that the buildmaster pays attention to. We also use
29-
# a shorter alias to save typing.
30-
c = BuildmasterConfig = {}
31-
3229
# Load the slave, database passwords and 3rd-party tokens from an external private file, so
3330
# that the rest of the configuration can be public.
3431
config = {"private": {}}
3532
exec(open("master-private.cfg").read(), config, {})
3633

37-
####### PROJECT IDENTITY
38-
39-
# the 'title' string will appear at the top of this buildbot installation's
40-
# home pages (linked to the 'titleURL').
41-
c["title"] = os.getenv("TITLE", default="MariaDB CI")
42-
c["titleURL"] = os.getenv("TITLE_URL", default="https://github.com/MariaDB/server")
43-
44-
# the 'buildbotURL' string should point to the location where the buildbot's
45-
# internal web server is visible. This typically uses the port number set in
46-
# the 'www' entry below, but with an externally-visible host name which the
47-
# buildbot cannot figure out without some help.
48-
c["buildbotURL"] = os.getenv("BUILDMASTER_URL", default="https://buildbot.mariadb.org/")
49-
50-
# 'protocols' contains information about protocols which master will use for
51-
# communicating with workers. You must define at least 'port' option that workers
52-
# could connect to your master with this protocol.
53-
# 'port' must match the value configured into the workers (with their
54-
# --master option)
55-
port = int(os.getenv("PORT", default="9989"))
56-
c["protocols"] = {"pb": {"port": port}}
57-
58-
####### DB URL
34+
# This is the dictionary that the buildmaster pays attention to. We also use
35+
# a shorter alias to save typing.
36+
c = BuildmasterConfig = base_master_config(
37+
title=os.getenv("TITLE", default="MariaDB CI"),
38+
title_url=os.getenv("TITLE_URL", default="https://github.com/MariaDB/server"),
39+
buildbot_url=os.getenv("BUILDMASTER_URL", default="https://buildbot.mariadb.org/"),
40+
github_access_token=config["private"]["gh_mdbci"]["access_token"],
41+
# TODO(cvicentiu) undo this hardcoding
42+
secrets_provider_file=os.getenv(
43+
"MASTER_CREDENTIALS_DIR",
44+
default="/srv/buildbot/master/master-credential-provider",
45+
),
46+
master_port=int(os.getenv("PORT", default="9989")),
47+
db_url=config["private"]["db_url"],
48+
mq_router_url=os.getenv("MQ_ROUTER_URL", default="ws://localhost:8085/ws"),
49+
)
5950

60-
c["db"] = {
61-
# This specifies what database buildbot uses to store its state.
62-
"db_url": config["private"]["db_url"]
63-
}
6451

6552
mtrDbPool = util.EqConnectionPool(
6653
"MySQLdb",
@@ -70,29 +57,10 @@ mtrDbPool = util.EqConnectionPool(
7057
config["private"]["db_mtr_db"],
7158
)
7259

73-
####### Disable net usage reports from being sent to buildbot.net
74-
c["buildbotNetUsageData"] = None
7560

76-
####### Services
77-
c["services"] = []
78-
context = util.Interpolate("buildbot/%(prop:buildername)s")
79-
gs = reporters.GitHubStatusPush(
80-
token=config["private"]["gh_mdbci"]["access_token"],
81-
context=context,
82-
startDescription="Build started.",
83-
endDescription="Build done.",
84-
verbose=True,
85-
builders=GITHUB_STATUS_BUILDERS,
86-
)
87-
c["services"].append(gs)
88-
c['secretsProviders'] = [secrets.SecretInAFile(dirname=os.getenv("MASTER_CREDENTIALS_DIR", default="/srv/buildbot/master/master-credential-provider"))]
8961
####### Builder priority
9062
c["prioritizeBuilders"] = prioritizeBuilders
9163

92-
####### SCHEDULERS
93-
94-
# Configure the Schedulers, which decide how to react to incoming changes.
95-
c["schedulers"] = SCHEDULERS
9664

9765
####### WORKERS
9866

@@ -159,9 +127,6 @@ f_windows_env = {
159127
}
160128
f_windows_env.update(MTR_ENV)
161129

162-
# f_quick_build = getQuickBuildFactory(mtrDbPool)
163-
f_rpm_autobake = getRpmAutobakeFactory(mtrDbPool)
164-
165130
## f_windows
166131
f_windows = util.BuildFactory()
167132
f_windows.addStep(
@@ -268,23 +233,22 @@ f_windows.addStep(
268233
)
269234

270235
windows_tests = {
271-
"nm": {
272-
"create_scripts": True
273-
},
236+
"nm": {"create_scripts": True},
274237
"connect": {
275238
"suites": ["connect"],
276239
},
277240
}
278241

279242
for typ in windows_tests:
280-
addWinTests(f_windows,
281-
mtr_test_type=typ,
282-
mtr_env=f_windows_env,
283-
mtr_additional_args=util.Property("mtr_additional_args", default=""),
284-
mtr_step_db_pool=mtrDbPool,
285-
mtr_suites=windows_tests[typ].get('suites',["default"]),
286-
create_scripts=windows_tests[typ].get('create_scripts',False)
287-
)
243+
addWinTests(
244+
f_windows,
245+
mtr_test_type=typ,
246+
mtr_env=f_windows_env,
247+
mtr_additional_args=util.Property("mtr_additional_args", default=""),
248+
mtr_step_db_pool=mtrDbPool,
249+
mtr_suites=windows_tests[typ].get("suites", ["default"]),
250+
create_scripts=windows_tests[typ].get("create_scripts", False),
251+
)
288252

289253

290254
f_windows.addStep(
@@ -300,13 +264,13 @@ f_windows.addStep(
300264
),
301265
url=util.Interpolate(
302266
f'{os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org")}'
303-
'/'
267+
"/"
304268
"%(prop:tarbuildnum)s"
305-
'/'
306-
'logs'
307-
'/'
308-
'%(prop:buildername)s'
309-
'/'
269+
"/"
270+
"logs"
271+
"/"
272+
"%(prop:buildername)s"
273+
"/"
310274
),
311275
)
312276
)
@@ -331,8 +295,16 @@ f_windows.addStep(
331295
## f_windows_msi
332296

333297
f_windows_msi_env = {
334-
"TMP": util.Interpolate("{0}\\%(prop:buildername)s\\build\\tmpdir".format('D:\\DEV\\Buildbot' if os.getenv('ENVIRON') == 'DEV' else 'D:\\Buildbot')),
335-
"TEMP": util.Interpolate("{0}\\%(prop:buildername)s\\build\\tmpdir".format('D:\\DEV\\Buildbot' if os.getenv('ENVIRON') == 'DEV' else 'D:\\Buildbot')),
298+
"TMP": util.Interpolate(
299+
"{0}\\%(prop:buildername)s\\build\\tmpdir".format(
300+
"D:\\DEV\\Buildbot" if os.getenv("ENVIRON") == "DEV" else "D:\\Buildbot"
301+
)
302+
),
303+
"TEMP": util.Interpolate(
304+
"{0}\\%(prop:buildername)s\\build\\tmpdir".format(
305+
"D:\\DEV\\Buildbot" if os.getenv("ENVIRON") == "DEV" else "D:\\Buildbot"
306+
)
307+
),
336308
}
337309
f_windows_msi_env.update(MTR_ENV)
338310

@@ -457,23 +429,22 @@ f_windows_msi.addStep(
457429
)
458430
)
459431
windows_msi_tests = {
460-
"nm": {
461-
"create_scripts": True
462-
},
432+
"nm": {"create_scripts": True},
463433
"connect": {
464434
"suites": ["connect"],
465435
},
466436
}
467437

468438
for typ in windows_msi_tests:
469-
addWinTests(f_windows_msi,
470-
mtr_test_type=typ,
471-
mtr_env=f_windows_msi_env,
472-
mtr_additional_args=util.Property("mtr_additional_args", default=""),
473-
mtr_step_db_pool=mtrDbPool,
474-
mtr_suites=windows_msi_tests[typ].get('suites',["default"]),
475-
create_scripts=windows_msi_tests[typ].get('create_scripts',False)
476-
)
439+
addWinTests(
440+
f_windows_msi,
441+
mtr_test_type=typ,
442+
mtr_env=f_windows_msi_env,
443+
mtr_additional_args=util.Property("mtr_additional_args", default=""),
444+
mtr_step_db_pool=mtrDbPool,
445+
mtr_suites=windows_msi_tests[typ].get("suites", ["default"]),
446+
create_scripts=windows_msi_tests[typ].get("create_scripts", False),
447+
)
477448

478449
f_windows_msi.addStep(
479450
steps.DirectoryUpload(
@@ -488,13 +459,13 @@ f_windows_msi.addStep(
488459
),
489460
url=util.Interpolate(
490461
f'{os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org")}'
491-
'/'
462+
"/"
492463
"%(prop:tarbuildnum)s"
493-
'/'
494-
'logs'
495-
'/'
496-
'%(prop:buildername)s'
497-
'/'
464+
"/"
465+
"logs"
466+
"/"
467+
"%(prop:buildername)s"
468+
"/"
498469
),
499470
)
500471
)
@@ -528,12 +499,11 @@ f_windows_msi.addStep(
528499
mode=0o755,
529500
url=util.Interpolate(
530501
f'{os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org")}'
531-
'/'
532-
'%(prop:tarbuildnum)s'
533-
'/'
534-
'%(prop:buildername)s'
535-
'/'
536-
502+
"/"
503+
"%(prop:tarbuildnum)s"
504+
"/"
505+
"%(prop:buildername)s"
506+
"/"
537507
),
538508
doStepIf=lambda step: savePackage(step, SAVED_PACKAGE_BRANCHES),
539509
)
@@ -551,11 +521,11 @@ f_windows_msi.addStep(
551521
mode=0o755,
552522
url=util.Interpolate(
553523
f'{os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org")}'
554-
'/'
555-
'%(prop:tarbuildnum)s'
556-
'/'
557-
'%(prop:buildername)s'
558-
'/'
524+
"/"
525+
"%(prop:tarbuildnum)s"
526+
"/"
527+
"%(prop:buildername)s"
528+
"/"
559529
),
560530
doStepIf=lambda step: savePackage(step, SAVED_PACKAGE_BRANCHES),
561531
)
@@ -739,22 +709,26 @@ f_dockerlibrary.addStep(
739709
f_dockerlibrary.addStep(
740710
steps.SetPropertyFromCommand(
741711
name="Extract the last tag created",
742-
command=['bash','-c','if [ -f last_tag ]; then cat last_tag; else echo ""; fi'],
712+
command=[
713+
"bash",
714+
"-c",
715+
'if [ -f last_tag ]; then cat last_tag; else echo ""; fi',
716+
],
743717
property="lasttag",
744718
)
745719
)
746720
f_dockerlibrary.addStep(
747721
steps.SetPropertyFromCommand(
748722
name="Determine sha for the last tag",
749723
command=[
750-
"bash",
724+
"bash",
751725
"-xc",
752726
util.Interpolate(
753727
'curl -s "https://quay.io/api/v1/repository/mariadb-foundation/mariadb-devel/tag/?filter_tag_name=eq:%(prop:lasttag)s&onlyActiveTags=true" | jq -r .tags[0].manifest_digest'
754728
),
755729
],
756730
property="lastsha",
757-
doStepIf=lambda step: (str(step.getProperty("lasttag")) != "")
731+
doStepIf=lambda step: (str(step.getProperty("lasttag")) != ""),
758732
)
759733
)
760734
f_dockerlibrary.addStep(
@@ -765,7 +739,9 @@ f_dockerlibrary.addStep(
765739
"-xc",
766740
"gh auth login --with-token < ~/gh_auth",
767741
],
768-
doStepIf=lambda step: (str(step.getProperty("lastsha")) != "null" and step.hasProperty("lastsha")),
742+
doStepIf=lambda step: (
743+
str(step.getProperty("lastsha")) != "null" and step.hasProperty("lastsha")
744+
),
769745
)
770746
)
771747

@@ -1132,24 +1108,12 @@ c["builders"].append(
11321108
"cxx_compiler": "clang++",
11331109
"mtr_env": {
11341110
"WSREP_PROVIDER": "/usr/local/lib/libgalera_smm.so",
1135-
}
11361111
},
1112+
},
11371113
nextBuild=nextBuild,
11381114
factory=f_freebsd,
11391115
)
11401116
)
11411117

11421118
# Add a Janitor configurator that removes old logs
11431119
c["configurators"] = [util.JanitorConfigurator(logHorizon=timedelta(weeks=6), hour=23)]
1144-
1145-
c["logEncoding"] = "utf-8"
1146-
1147-
c["multiMaster"] = True
1148-
1149-
c["mq"] = { # Need to enable multimaster aware mq. Wamp is the only option for now.
1150-
"type": "wamp",
1151-
"router_url": os.getenv("MQ_ROUTER_URL", default="ws://localhost:8085/ws"),
1152-
"realm": "realm1",
1153-
# valid are: none, critical, error, warn, info, debug, trace
1154-
"wamp_debug_level": "info",
1155-
}

0 commit comments

Comments
 (0)