Skip to content

Commit

Permalink
Move master-docker-nonstandard to use common master setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cvicentiu committed Jan 12, 2025
1 parent cb7f0fb commit 4f86d19
Showing 1 changed file with 37 additions and 98 deletions.
135 changes: 37 additions & 98 deletions master-docker-nonstandard/master.cfg
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
# -*- python -*-
# ex: set filetype=python:

from buildbot.plugins import *
from buildbot.process.properties import Property, Properties
from buildbot.steps.shell import ShellCommand, Compile, Test, SetPropertyFromCommand
from buildbot.steps.mtrlogobserver import MTR, MtrLogObserver
from buildbot.steps.source.github import GitHub
from buildbot.process.remotecommand import RemoteCommand
from datetime import timedelta
from twisted.internet import defer

import docker
import os
import sys
from collections import defaultdict

sys.path.insert(0, "/srv/buildbot/master")
sys.setrecursionlimit(10000)

from common_factories import *
from constants import *
from locks import *
from schedulers_definition import SCHEDULERS
from utils import *
import docker
from buildbot.plugins import steps, util, worker
from buildbot.process.properties import Property
from common_factories import (
addTests,
getHTMLLogString,
getQuickBuildFactory,
getRpmAutobakeFactory,
getSourceTarball,
)
from constants import MTR_ENV
from locks import getLocks
from master_common import base_master_config
from utils import (
canStartBuild,
createVar,
createWorker,
dockerfile,
filterBranch,
hasAutobake,
hasBigtest,
hasEco,
hasFailed,
moveMTRLogs,
mtrJobsMultiplier,
nextBuild,
printEnv,
saveLogs,
savePackage,
)

FQDN = os.environ["BUILDMASTER_WG_IP"]

Expand All @@ -43,61 +54,11 @@ config = {"private": {}}
with open(os.path.join(base_dir, "master-private.cfg"), "r") as file:
exec(file.read(), config, {})


# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}


####### BUILDBOT SERVICES

# 'services' is a list of BuildbotService items like reporter targets. The
# status of each build will be pushed to these targets. buildbot/reporters/*.py
# has a variety to choose from, like IRC bots.


c["services"] = []
context = util.Interpolate("buildbot/%(prop:buildername)s")
gs = reporters.GitHubStatusPush(
token=config["private"]["gh_mdbci"]["access_token"],
context=context,
startDescription="Build started.",
endDescription="Build done.",
verbose=True,
builders=GITHUB_STATUS_BUILDERS,
)
c["services"].append(gs)
c["secretsProviders"] = [
secrets.SecretInAFile(
dirname=os.environ["MASTER_CREDENTIALS_DIR"]
)
]
####### PROJECT IDENTITY

# the 'title' string will appear at the top of this buildbot installation's
# home pages (linked to the 'titleURL').
c["title"] = os.environ["TITLE"]
c["titleURL"] = os.environ["TITLE_URL"]

# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server is visible. This typically uses the port number set in
# the 'www' entry below, but with an externally-visible host name which the
# buildbot cannot figure out without some help.
c["buildbotURL"] = os.environ["BUILDMASTER_URL"]

# 'protocols' contains information about protocols which master will use for
# communicating with workers. You must define at least 'port' option that workers
# could connect to your master with this protocol.
# 'port' must match the value configured into the workers (with their
# --master option)
port = int(os.environ["PORT"])
c["protocols"] = {"pb": {"port": port}}

####### DB URL

c["db"] = {
# This specifies what database buildbot uses to store its state.
"db_url": config["private"]["db_url"]
}
c = BuildmasterConfig = base_master_config(config)


mtrDbPool = util.EqConnectionPool(
"MySQLdb",
Expand All @@ -107,14 +68,6 @@ mtrDbPool = util.EqConnectionPool(
config["private"]["db_mtr_db"],
)

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

####### SCHEDULERS

# Configure the Schedulers, which decide how to react to incoming changes.
c["schedulers"] = SCHEDULERS

####### WORKERS

# The 'workers' list defines the set of recognized workers. Each element is
Expand Down Expand Up @@ -149,8 +102,6 @@ def addWorker(


# Docker workers
fqdn = os.environ["BUILDMASTER_WG_IP"]

## hz-bbw2-docker
c["workers"].append(
worker.DockerLatentWorker(
Expand All @@ -159,7 +110,7 @@ c["workers"].append(
docker_host=config["private"]["docker_workers"]["hz-bbw2-docker"],
dockerfile=open("dockerfiles/eco-php-ubuntu-2004.dockerfile").read(),
followStartupLogs=False,
masterFQDN=fqdn,
masterFQDN=FQDN,
hostconfig={
"shm_size": "6G",
"ulimits": [
Expand All @@ -182,7 +133,7 @@ c["workers"].append(
"dockerfiles/eco-pymysql-python-3-9-slim-buster.dockerfile"
).read(),
followStartupLogs=False,
masterFQDN=fqdn,
masterFQDN=FQDN,
hostconfig={
"shm_size": "6G",
"ulimits": [
Expand All @@ -203,7 +154,7 @@ c["workers"].append(
docker_host=config["private"]["docker_workers"]["hz-bbw2-docker"],
dockerfile=open("dockerfiles/eco-mysqljs-nodejs15-buster.dockerfile").read(),
followStartupLogs=False,
masterFQDN=fqdn,
masterFQDN=FQDN,
hostconfig={
"shm_size": "6G",
"ulimits": [
Expand All @@ -229,7 +180,7 @@ c["workers"].append(
followStartupLogs=False,
autopull=True,
alwaysPull=True,
masterFQDN=fqdn,
masterFQDN=FQDN,
hostconfig={
"shm_size": "20G",
"ulimits": [
Expand Down Expand Up @@ -1794,15 +1745,3 @@ c["builders"].append(
factory=f_prep_local,
)
)

c["logEncoding"] = "utf-8"

c["multiMaster"] = True

c["mq"] = { # Need to enable multimaster aware mq. Wamp is the only option for now.
"type": "wamp",
"router_url": os.environ["MQ_ROUTER_URL"],
"realm": "realm1",
# valid are: none, critical, error, warn, info, debug, trace
"wamp_debug_level": "info",
}

0 comments on commit 4f86d19

Please sign in to comment.