1
1
# -*- python -*-
2
2
# ex: set filetype=python:
3
3
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
14
4
import os
15
- import sys
16
-
17
- sys .setrecursionlimit (10000 )
5
+ from datetime import timedelta
18
6
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
+ )
24
25
25
26
####### VARIABLES
26
27
vsWarningPattern = "^.*: warning C.*$"
27
28
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
-
32
29
# Load the slave, database passwords and 3rd-party tokens from an external private file, so
33
30
# that the rest of the configuration can be public.
34
31
config = {"private" : {}}
35
32
exec (open ("master-private.cfg" ).read (), config , {})
36
33
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
+ )
59
50
60
- c ["db" ] = {
61
- # This specifies what database buildbot uses to store its state.
62
- "db_url" : config ["private" ]["db_url" ]
63
- }
64
51
65
52
mtrDbPool = util .EqConnectionPool (
66
53
"MySQLdb" ,
@@ -70,29 +57,10 @@ mtrDbPool = util.EqConnectionPool(
70
57
config ["private" ]["db_mtr_db" ],
71
58
)
72
59
73
- ####### Disable net usage reports from being sent to buildbot.net
74
- c ["buildbotNetUsageData" ] = None
75
60
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" ))]
89
61
####### Builder priority
90
62
c ["prioritizeBuilders" ] = prioritizeBuilders
91
63
92
- ####### SCHEDULERS
93
-
94
- # Configure the Schedulers, which decide how to react to incoming changes.
95
- c ["schedulers" ] = SCHEDULERS
96
64
97
65
####### WORKERS
98
66
@@ -159,9 +127,6 @@ f_windows_env = {
159
127
}
160
128
f_windows_env .update (MTR_ENV )
161
129
162
- # f_quick_build = getQuickBuildFactory(mtrDbPool)
163
- f_rpm_autobake = getRpmAutobakeFactory (mtrDbPool )
164
-
165
130
## f_windows
166
131
f_windows = util .BuildFactory ()
167
132
f_windows .addStep (
@@ -268,23 +233,22 @@ f_windows.addStep(
268
233
)
269
234
270
235
windows_tests = {
271
- "nm" : {
272
- "create_scripts" : True
273
- },
236
+ "nm" : {"create_scripts" : True },
274
237
"connect" : {
275
238
"suites" : ["connect" ],
276
239
},
277
240
}
278
241
279
242
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
+ )
288
252
289
253
290
254
f_windows .addStep (
@@ -300,13 +264,13 @@ f_windows.addStep(
300
264
),
301
265
url = util .Interpolate (
302
266
f'{ os .getenv ("ARTIFACTS_URL" , default = "https://ci.mariadb.org" )} '
303
- '/'
267
+ "/"
304
268
"%(prop:tarbuildnum)s"
305
- '/'
306
- ' logs'
307
- '/'
308
- ' %(prop:buildername)s'
309
- '/'
269
+ "/"
270
+ " logs"
271
+ "/"
272
+ " %(prop:buildername)s"
273
+ "/"
310
274
),
311
275
)
312
276
)
@@ -331,8 +295,16 @@ f_windows.addStep(
331
295
## f_windows_msi
332
296
333
297
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
+ ),
336
308
}
337
309
f_windows_msi_env .update (MTR_ENV )
338
310
@@ -457,23 +429,22 @@ f_windows_msi.addStep(
457
429
)
458
430
)
459
431
windows_msi_tests = {
460
- "nm" : {
461
- "create_scripts" : True
462
- },
432
+ "nm" : {"create_scripts" : True },
463
433
"connect" : {
464
434
"suites" : ["connect" ],
465
435
},
466
436
}
467
437
468
438
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
+ )
477
448
478
449
f_windows_msi .addStep (
479
450
steps .DirectoryUpload (
@@ -488,13 +459,13 @@ f_windows_msi.addStep(
488
459
),
489
460
url = util .Interpolate (
490
461
f'{ os .getenv ("ARTIFACTS_URL" , default = "https://ci.mariadb.org" )} '
491
- '/'
462
+ "/"
492
463
"%(prop:tarbuildnum)s"
493
- '/'
494
- ' logs'
495
- '/'
496
- ' %(prop:buildername)s'
497
- '/'
464
+ "/"
465
+ " logs"
466
+ "/"
467
+ " %(prop:buildername)s"
468
+ "/"
498
469
),
499
470
)
500
471
)
@@ -528,12 +499,11 @@ f_windows_msi.addStep(
528
499
mode = 0o755 ,
529
500
url = util .Interpolate (
530
501
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
+ "/"
537
507
),
538
508
doStepIf = lambda step : savePackage (step , SAVED_PACKAGE_BRANCHES ),
539
509
)
@@ -551,11 +521,11 @@ f_windows_msi.addStep(
551
521
mode = 0o755 ,
552
522
url = util .Interpolate (
553
523
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
+ "/"
559
529
),
560
530
doStepIf = lambda step : savePackage (step , SAVED_PACKAGE_BRANCHES ),
561
531
)
@@ -739,22 +709,26 @@ f_dockerlibrary.addStep(
739
709
f_dockerlibrary .addStep (
740
710
steps .SetPropertyFromCommand (
741
711
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
+ ],
743
717
property = "lasttag" ,
744
718
)
745
719
)
746
720
f_dockerlibrary .addStep (
747
721
steps .SetPropertyFromCommand (
748
722
name = "Determine sha for the last tag" ,
749
723
command = [
750
- "bash" ,
724
+ "bash" ,
751
725
"-xc" ,
752
726
util .Interpolate (
753
727
'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'
754
728
),
755
729
],
756
730
property = "lastsha" ,
757
- doStepIf = lambda step : (str (step .getProperty ("lasttag" )) != "" )
731
+ doStepIf = lambda step : (str (step .getProperty ("lasttag" )) != "" ),
758
732
)
759
733
)
760
734
f_dockerlibrary .addStep (
@@ -765,7 +739,9 @@ f_dockerlibrary.addStep(
765
739
"-xc" ,
766
740
"gh auth login --with-token < ~/gh_auth" ,
767
741
],
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
+ ),
769
745
)
770
746
)
771
747
@@ -1132,24 +1108,12 @@ c["builders"].append(
1132
1108
"cxx_compiler" : "clang++" ,
1133
1109
"mtr_env" : {
1134
1110
"WSREP_PROVIDER" : "/usr/local/lib/libgalera_smm.so" ,
1135
- }
1136
1111
},
1112
+ },
1137
1113
nextBuild = nextBuild ,
1138
1114
factory = f_freebsd ,
1139
1115
)
1140
1116
)
1141
1117
1142
1118
# Add a Janitor configurator that removes old logs
1143
1119
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