Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDBF-960: Document environment variables in master-libvirt #706

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 85 additions & 112 deletions master-libvirt/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
# ex: set filetype=python:

import os
from dataclasses import dataclass

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, printEnv


cfg_dir = os.path.abspath(os.path.dirname(__file__))

# Non autogen master. For now the directory structure is:
Expand All @@ -33,32 +35,59 @@ c = BuildmasterConfig = base_master_config(config)
artifactsURL = os.environ["ARTIFACTS_URL"]


INSTALL_UPGRADE_PROPERTIES_LIST = [
# Must be set to True in BB for upgrade scripts to work
"BB_CI",
# TODO(cvicentiu) compared to arm64 instead of aarch64 in scripts/deb-install.sh
# amd64, aarch64, ppc64le, s390x, x86
"arch",
# Where artifacts are downloaded from ci.mariadb.org
"artifactsURL",
# Impacts upgrade and install logic. Same value as the branch in git
# (incl. bb- prefix and other suffixes).
"branch",
# almalinux, centos, debian, fedora, openeuler, rhel, ubuntu, rockylinux
"dist_name",
# compared to "yes" in rpm-upgrade.sh, but never set.
# TODO(cvicentiu) investigate and fix this.
"is_main_tree",
# TODO(cvicentiu) This should be handled within the script, not BB, mariadb_version should be enough.
# extracted from mariadb_version variable as a separate BB step.
"major_version",
# Eg. mariadb-10.11.12, comes from parent (tarball) builder props,
# based on tarball filename.
"mariadb_version",
# Set from parent (tarball) builder. First two numbers from mariadb_version.
"master_branch",
# TODO(cvicentiu) investigate and remove this one.
# Set to "yes" / "no" within this file, but never used anywhere.
"needsGalera",
# Set to the builder that triggered this install/upgrade
# Used during install scripts to create builder URL.
"parentbuildername",
# TODO(cvicentiu) This should be removed from install / upgrade scripts.
# and finally removed from here.
# Always set to "yes" within this file.
"systemdCapability",
# "server", "all", "columnstore", "deps"
# Impacts which tests are run. Set within this file only.
"test_mode",
# "major", "minor"
# Impacts which tests are run. set within this file.
"test_type",
# Loaded from os_info.yaml. Impacts upgrade & install tests.
"version_name",
]


####### UTILS
def getRpmUpgradeStep():
return Test(
name="upgrade",
haltOnFailure=True,
description=["testing", "upgrade"],
descriptionDone=["test", "upgrade"],
env=envFromProperties(
[
"BB_CI",
"arch",
"artifactsURL",
"branch",
"dist_name",
"is_main_tree",
"major_version",
"mariadb_version",
"master_branch",
"needsGalera",
"parentbuildername",
"systemdCapability",
"test_mode",
"test_type",
"version_name",
]
),
env=envFromProperties(INSTALL_UPGRADE_PROPERTIES_LIST),
command=["./rpm-upgrade.sh"],
)

Expand All @@ -69,24 +98,7 @@ def getRpmInstallStep():
haltOnFailure=True,
description=["testing", "install"],
descriptionDone=["test", "install"],
env=envFromProperties(
[
"BB_CI",
"arch",
"artifactsURL",
"branch",
"dist_name",
"major_version",
"mariadb_version",
"master_branch",
"needsGalera",
"parentbuildername",
"systemdCapability",
"test_mode",
"test_type",
"version_name",
]
),
env=envFromProperties(INSTALL_UPGRADE_PROPERTIES_LIST),
command=["./rpm-install.sh"],
)

Expand All @@ -97,24 +109,7 @@ def getDebUpgradeStep():
haltOnFailure=True,
description=["testing", "upgrade"],
descriptionDone=["test", "upgrade"],
env=envFromProperties(
[
"BB_CI",
"arch",
"artifactsURL",
"branch",
"dist_name",
"major_version",
"mariadb_version",
"master_branch",
"needsGalera",
"parentbuildername",
"systemdCapability",
"test_mode",
"test_type",
"version_name",
]
),
env=envFromProperties(INSTALL_UPGRADE_PROPERTIES_LIST),
command=["./deb-upgrade.sh"],
)

Expand All @@ -125,24 +120,7 @@ def getDebInstallStep():
haltOnFailure=True,
description=["testing", "install"],
descriptionDone=["test", "install"],
env=envFromProperties(
[
"BB_CI",
"arch",
"artifactsURL",
"branch",
"dist_name",
"major_version",
"mariadb_version",
"master_branch",
"needsGalera",
"parentbuildername",
"systemdCapability",
"test_mode",
"test_type",
"version_name",
]
),
env=envFromProperties(INSTALL_UPGRADE_PROPERTIES_LIST),
command=["./deb-install.sh"],
)

Expand Down Expand Up @@ -208,6 +186,23 @@ f_rpm_upgrade.addStep(getRpmUpgradeStep())
c["workers"] = []
c["builders"] = []


@dataclass
class LibVirtWorkerSpecs:
name: str
connection_url: str
image_path: str
password: str

def __init__(self, platform: str, os_name: str, os_version: str):
host, url = config["private"]["libvirt_workers"][platform]
name = f"{host}-{os_name}-{os_version}-{platform}", url
super().__init__(name=name,
connection_url=url,
image_path=f"/var/libvirt/images/{name}",
password=config["private"]["worker_pass"]["libvirt"])


# Add the workers and builds based on the configured install builders (see constants.py)
for builder_name in BUILDERS_INSTALL:
# Parse builder name
Expand All @@ -217,50 +212,28 @@ for builder_name in BUILDERS_INSTALL:

os_info_name = os_name + "-" + os_version

libvirt_worker_name = (
config["private"]["libvirt_workers"][platform][0]
+ "-"
+ os_name
+ "-"
+ os_version
+ "-"
+ platform
)
connection_url = config["private"]["libvirt_workers"][platform][1]
image_path = "/var/libvirt/images/" + libvirt_worker_name
worker_specs = LibVirtWorkerSpecs(platform=platform,
os_name=os_name,
os_version=os_version)

c["workers"].append(
worker.LibVirtWorker(
libvirt_worker_name,
config["private"]["worker_pass"]["libvirt"],
util.Connection(connection_url),
image_path,
worker_specs.name,
worker_specs.password,
util.Connection(worker_specs.connection_url),
worker_specs.image_path,
build_wait_timeout=0,
max_builds=1,
)
)

if builder_type == "deb":
factory_install = f_deb_install
factory_upgrade = f_deb_upgrade
build_arch = platform
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
)

# 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}"
factory_install = f_deb_install if builder_type == "deb" else f_rpm_install
factory_upgrade = f_deb_upgrade if builder_type == "deb" else f_rpm_upgrade

c["builders"].append(
util.BuilderConfig(
name=builder_name,
workernames=libvirt_worker_name,
workernames=worker_specs.name,
tags=[os_name, builder_type, "install", "kvm"],
collapseRequests=True,
nextBuild=nextBuild,
Expand All @@ -270,7 +243,7 @@ for builder_name in BUILDERS_INSTALL:
"needsGalera": "yes",
"dist_name": os_name,
"version_name": OS_INFO[os_info_name]["version_name"],
"arch": build_arch,
"arch": platform,
"BB_CI": True,
"artifactsURL": artifactsURL,
},
Expand All @@ -284,7 +257,7 @@ for builder_name in BUILDERS_INSTALL:
c["builders"].append(
util.BuilderConfig(
name=major_upgrade_name,
workernames=libvirt_worker_name,
workernames=worker_specs.name,
tags=[os_name, builder_type, "upgrade", "kvm", "major", "server"],
collapseRequests=True,
nextBuild=nextBuild,
Expand All @@ -294,7 +267,7 @@ for builder_name in BUILDERS_INSTALL:
"needsGalera": "yes",
"dist_name": os_name,
"version_name": OS_INFO[os_info_name]["version_name"],
"arch": build_arch,
"arch": platform,
Copy link
Collaborator

@RazvanLiviuVarzaru RazvanLiviuVarzaru Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cvicentiu We need to test on Dev if a re-build is causing a re-calculation of the "arch" property.
My guess is Yes, but if "arch" is not updated on re-build then we end up with an incompatible change with the scripts.
We need to be sure that we can re-build runs at least for a couple of days in the past.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be logical for properties to be recomputed, but yes, I agree, we should check this.

"test_mode": "server",
"test_type": "major",
"BB_CI": True,
Expand All @@ -310,7 +283,7 @@ for builder_name in BUILDERS_INSTALL:
c["builders"].append(
util.BuilderConfig(
name=minor_upgrade_name + "-all",
workernames=libvirt_worker_name,
workernames=worker_specs.name,
tags=[os_name, builder_type, "upgrade", "kvm", "minor", "all"],
collapseRequests=True,
nextBuild=nextBuild,
Expand All @@ -320,7 +293,7 @@ for builder_name in BUILDERS_INSTALL:
"needsGalera": "yes",
"dist_name": os_name,
"version_name": OS_INFO[os_info_name]["version_name"],
"arch": build_arch,
"arch": platform,
"test_mode": "all",
"test_type": "minor",
"BB_CI": True,
Expand All @@ -334,7 +307,7 @@ for builder_name in BUILDERS_INSTALL:
c["builders"].append(
util.BuilderConfig(
name=minor_upgrade_name + "-columnstore",
workernames=libvirt_worker_name,
workernames=worker_specs.name,
tags=[os_name, builder_type, "upgrade", "kvm", "minor", "columnstore"],
collapseRequests=True,
nextBuild=nextBuild,
Expand All @@ -344,7 +317,7 @@ for builder_name in BUILDERS_INSTALL:
"needsGalera": "no",
"dist_name": os_name,
"version_name": OS_INFO[os_info_name]["version_name"],
"arch": build_arch,
"arch": platform,
"test_mode": "columnstore",
"test_type": "minor",
"BB_CI": True,
Expand Down
Loading