From 8858fbd33e4807317e8aef068522b4327eb49cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Wed, 4 Dec 2024 16:10:34 +0200 Subject: [PATCH] Master-libvirt move to common class --- master-libvirt/master.cfg | 82 +++++++-------------------------------- 1 file changed, 14 insertions(+), 68 deletions(-) diff --git a/master-libvirt/master.cfg b/master-libvirt/master.cfg index 6f6ec19b..88205ff7 100644 --- a/master-libvirt/master.cfg +++ b/master-libvirt/master.cfg @@ -1,25 +1,14 @@ # -*- 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 +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 cfg_dir = os.path.abspath(os.path.dirname(__file__)) @@ -30,7 +19,7 @@ cfg_dir = os.path.abspath(os.path.dirname(__file__)) #     └── master.cfg # # Non autogen masters load from for now. -base_dir = os.path.abspath(f'{cfg_dir}/../') +base_dir = os.path.abspath(f"{cfg_dir}/../") # Load the slave, database passwords and 3rd-party tokens from an external private file, so # that the rest of the configuration can be public. @@ -40,41 +29,10 @@ with open(os.path.join(base_dir, "master-private.cfg"), "r") as file: # This is the dictionary that the buildmaster pays attention to. We also use # a shorter alias to save typing. -c = BuildmasterConfig = {} - - -####### PROJECT IDENTITY +c = BuildmasterConfig = base_master_config(config) -# 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"] artifactsURL = os.environ["ARTIFACTS_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"] -} - -####### Disable net usage reports from being sent to buildbot.net -c["buildbotNetUsageData"] = None - ####### UTILS def getRpmUpgradeStep(): @@ -133,6 +91,7 @@ def getRpmInstallStep(): command=["./rpm-install.sh"], ) + def getDebUpgradeStep(): return Test( name="upgrade", @@ -198,6 +157,7 @@ def getMajorVersionStep(): ), ) + def getPAMTestStep(): return Test( name="PAM authentication test", @@ -212,34 +172,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 @@ -287,7 +244,9 @@ 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: @@ -295,7 +254,6 @@ for builder_name in BUILDERS_INSTALL: platform = "x86_64" build_arch = f"centos/{OS_INFO[os_info_name]['version_name']}/{platform}" - c["builders"].append( util.BuilderConfig( name=builder_name, @@ -392,15 +350,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.environ["MQ_ROUTER_URL"], - "realm": "realm1", - # valid are: none, critical, error, warn, info, debug, trace - "wamp_debug_level": "info", -}