Skip to content

Commit

Permalink
Master-libvirt move to common class
Browse files Browse the repository at this point in the history
  • Loading branch information
cvicentiu committed Dec 4, 2024
1 parent 56ddb71 commit e4c87b8
Showing 1 changed file with 26 additions and 70 deletions.
96 changes: 26 additions & 70 deletions master-libvirt/master.cfg
Original file line number Diff line number Diff line change
@@ -1,67 +1,35 @@
# -*- 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

sys.setrecursionlimit(10000)

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

from utils import *
from constants import os_info

# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
from buildbot.plugins import steps, util, worker
from buildbot.steps.shell import Test
from constants import BUILDERS_INSTALL, os_info
from master_common import base_master_config
from utils import canStartBuild, envFromProperties, getScript, nextBuild

# Load the slave, database passwords and 3rd-party tokens from an external private file, so
# that the rest of the configuration can be public.
config = {"private": {}}
exec(open("../master-private.cfg").read(), config, {})
exec(open("master-private.cfg").read(), config, {})

####### PROJECT IDENTITY
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = base_master_config(
title=os.getenv("TITLE", default="MariaDB CI"),
title_url=os.getenv("TITLE_URL", default="https://github.com/MariaDB/server"),
buildbot_url=os.getenv("BUILDMASTER_URL", default="https://buildbot.mariadb.org/"),
github_access_token=config["private"]["gh_mdbci"]["access_token"],
# TODO(cvicentiu) undo this hardcoding
secrets_provider_file="/srv/buildbot/master/master-credential-provider",
master_port=int(os.getenv("PORT", default="9990")),
db_url=config["private"]["db_url"],
mq_router_url=os.getenv("MQ_ROUTER_URL", default="ws://localhost:8085/ws"),
)

# the 'title' string will appear at the top of this buildbot installation's
# home pages (linked to the 'titleURL').
c["title"] = os.getenv("TITLE", default="MariaDB CI")
c["titleURL"] = os.getenv("TITLE_URL", default="https://github.com/MariaDB/server")
artifactsURL = os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org")

# 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.getenv("BUILDMASTER_URL", default="https://buildbot.mariadb.org/")

# '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.getenv("PORT", default="9990"))
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"]
}

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


####### UTILS
def getRpmUpgradeStep():
Expand Down Expand Up @@ -120,6 +88,7 @@ def getRpmInstallStep():
command=["./rpm-install.sh"],
)


def getDebUpgradeStep():
return Test(
name="upgrade",
Expand Down Expand Up @@ -185,6 +154,7 @@ def getMajorVersionStep():
),
)


def getPAMTestStep():
return Test(
name="PAM authentication test",
Expand All @@ -199,34 +169,31 @@ def getPAMTestStep():
command=["./pam-test.sh"],
)

# FACTORY

## f_deb_install
# FACTORY
f_deb_install = util.BuildFactory()
f_deb_install.addStep(getScript("deb-install.sh"))
f_deb_install.addStep(getDebInstallStep())
f_deb_install.addStep(getScript("pam-test.sh"))
f_deb_install.addStep(getPAMTestStep())

## f_deb_upgrade
f_deb_upgrade = util.BuildFactory()
f_deb_upgrade.addStep(getMajorVersionStep())
f_deb_upgrade.addStep(getScript("deb-upgrade.sh"))
f_deb_upgrade.addStep(getDebUpgradeStep())

## f_rpm_install
f_rpm_install = util.BuildFactory()
f_rpm_install.addStep(getScript("rpm-install.sh"))
f_rpm_install.addStep(getRpmInstallStep())
f_rpm_install.addStep(getScript("pam-test.sh"))
f_rpm_install.addStep(getPAMTestStep())

## f_rpm_upgrade
f_rpm_upgrade = util.BuildFactory()
f_rpm_upgrade.addStep(getMajorVersionStep())
f_rpm_upgrade.addStep(getScript("rpm-upgrade.sh"))
f_rpm_upgrade.addStep(getRpmUpgradeStep())


####### WORKERS and BUILDERS

# The 'workers' list defines the set of recognized workers. Each element is
Expand Down Expand Up @@ -274,15 +241,16 @@ for builder_name in BUILDERS_INSTALL:
elif builder_type == "rpm":
factory_install = f_rpm_install
factory_upgrade = f_rpm_upgrade
build_arch = os_name + str(os_info[os_info_name]["version_name"]) + "-" + platform
build_arch = (
os_name + str(os_info[os_info_name]["version_name"]) + "-" + platform
)

# FIXME - all RPM's should follow the same conventions!
if os_name == "centos" and os_info[os_info_name]["version_name"] >= 9:
if platform == "amd64":
platform = "x86_64"
build_arch = f"centos/{os_info[os_info_name]['version_name']}/{platform}"


c["builders"].append(
util.BuilderConfig(
name=builder_name,
Expand Down Expand Up @@ -379,15 +347,3 @@ for builder_name in BUILDERS_INSTALL:
factory=factory_upgrade,
)
)

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.getenv("MQ_ROUTER_URL", default="ws://localhost:8085/ws"),
"realm": "realm1",
# valid are: none, critical, error, warn, info, debug, trace
"wamp_debug_level": "info",
}

0 comments on commit e4c87b8

Please sign in to comment.