Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cvicentiu committed Dec 14, 2024
1 parent 8ac1654 commit 665f5e4
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 135 deletions.
44 changes: 22 additions & 22 deletions define_masters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,53 @@
builder_name = arch + "-" + os_name
if arch not in platforms:
platforms[arch] = []
platforms[arch].append(builder_name)
platforms[arch].append({
os_name: {
'image_tag': os_info[os_name]['image_tag'],
# TODO(cvicentiu) load tags from os_info.
'tags': ['autobake', 'release_packages', 'bleeding_edge']
}
})

# Clear old configurations
if os.path.exists(BASE_PATH):
shutil.rmtree(BASE_PATH)

IDX = 0
idx = 0
for arch in platforms:
master_variables = config["private"]["master-variables"]
# Create the directory for the architecture that is handled by each master
# If for a given architecture there are more than "max_builds" builds,
# create multiple masters
# "max_builds" is defined is master-private.py
num_masters = (
int(len(platforms[arch]) / config["private"]["master-variables"]["max_builds"])
+ 1
int(len(platforms[arch]) / master_variables["max_builds"]) + 1
)

for master_id in range(num_masters):
dir_path = BASE_PATH + arch + "-master-" + str(master_id)
dir_path = f'{BASE_PATH}{arch}-master-{master_id}'
os.makedirs(dir_path)

master_config = {}
master_config["builders"] = platforms[arch]
master_config["workers"] = config["private"]["master-variables"]["workers"][
arch
]
master_config = {
'builders': {arch: platforms[arch]},
'workers': master_variables["workers"][arch],
'port': master_variables["starting_port"] + idx,
'log_name': f'master-docker-{arch}-{master_id}.log'

starting_port = int(
os.getenv(
"PORT", default=config["private"]["master-variables"]["starting_port"]
)
)
master_config["port"] = starting_port + IDX
master_config["log_name"] = (
"master-docker-" + arch + "-" + str(master_id) + ".log"
)

with open(dir_path + "/master-config.yaml", mode="w", encoding="utf-8") as file:
}
with open(f"{dir_path}/master-config.yaml", mode="w",
encoding="utf-8") as file:
yaml.dump(master_config, file)

shutil.copyfile("master.cfg", dir_path + "/master.cfg")
shutil.copyfile("master-private.cfg", dir_path + "/master-private.cfg")

# TODO(cvicentiu) fix this through environment variables, not this
# weird hardcoding and code generation.
buildbot_tac = (
open("buildbot.tac", encoding="utf-8").read() % master_config["log_name"]
)
with open(dir_path + "/buildbot.tac", mode="w", encoding="utf-8") as f:
f.write(buildbot_tac)
IDX += 1
idx += 1
print(arch, len(master_config["builders"]))
12 changes: 1 addition & 11 deletions docker-compose/.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ NGINX_CR_HOST_WG_ADDR="100.64.100.20:8080"
ENVIRON="PROD"
BRANCH="main"
MASTER_NONLATENT_DOCKERLIBRARY_WORKER="bb-rhel8-docker"
MASTER_NONLATENT_BINTARS_WORKERS = '
{
"ro-apexis-bbw03-x64": {
"max_builds": 2,
"jobs": 12
},
"bg-bbw1-x64": {
"max_builds": 1,
"jobs": 12
}
}'
MASTER_NONLATENT_BINTARS_WORKERS='{ "ro-apexis-bbw03-x64": { "max_builds": 2, "jobs": 12 }, "bg-bbw1-x64": { "max_builds": 1, "jobs": 12 } }'
MASTER_NONLATENT_BINTARS_VM_PORT="10000"
MASTER_NONLATENT_BINTARS_WORKER_PORT="10007"
CONTAINER_REGISTRY_URL="quay.io/mariadb-foundation/bb-worker:"
43 changes: 35 additions & 8 deletions master-config.yaml-sample
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
builders:
- aarch64-centos-stream9
- aarch64-debian-11
- aarch64-debian-12
- aarch64-debian-sid
- aarch64-rhel-8
- aarch64-rhel-9
- aarch64-ubuntu-2004
- aarch64-ubuntu-2204
aarch64:
centos-stream9:
tags:
- release_packages
- autobake
- bleeding-edge
debian-11:
tags:
- release_packages
- autobake
debian-12:
tags:
- release_packages
- autobake
debian-sid:
tags:
- release_packages
- autobake
- bleeding-edge
rhel-8:
tags:
- release_packages
- autobake
rhel-9:
tags:
- release_packages
- autobake
ubuntu-2004:
tags:
- release_packages
- autobake
ubuntu-2204:
tags:
- release_packages
- autobake
log_name: master-docker-aarch64-0.log
port: 9998
workers:
Expand Down
178 changes: 84 additions & 94 deletions master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ from common_factories import (
getSourceTarball,
)
from constants import (
BUILDERS_GALERA_MTR,
GITHUB_STATUS_BUILDERS,
SAVED_PACKAGE_BRANCHES,
os_info,
Expand Down Expand Up @@ -85,40 +84,50 @@ c["workers"] = []

workers = defaultdict(list)

print('Loading workers')
print(os.environ)
for w_name in master_config["workers"]:
jobs = 7
print(w_name)

for arch in master_config["builders"]:
builders = master_config["builders"][arch]
for builder in builders:
print('Loading workers builder', builder)
worker_name = w_name[:-1]
worker_id = w_name[-1]

os_name = "-".join(builder.split("-")[1:])
image_tag = "".join(os_name.split("-"))

# Skip s390x non-SLES builders on SLES host (bbw2)
if ("s390x" in builder) and (worker_id == "2") and ("sles" not in os_name):
continue

if image_tag.startswith("ubuntu"):
image_tag = image_tag[:-2] + "." + image_tag[-2:]

quay_name = f'{os.environ["CONTAINER_REGISTRY_URL"]}{image_tag}'
if builder.startswith("x86"):
os_name += "-i386"
quay_name += "-386"

base_name, name, worker_instance = createWorker(
worker_name,
worker_id,
os_name,
quay_name,
jobs=jobs,
save_packages=True,
shm_size="15G",
)

for builder in master_config["builders"]:
worker_name = w_name[:-1]
worker_id = w_name[-1]

os_name = "-".join(builder.split("-")[1:])
image_tag = "".join(os_name.split("-"))

# Skip s390x non-SLES builders on SLES host (bbw2)
if ("s390x" in builder) and (worker_id == "2") and ("sles" not in os_name):
continue

if image_tag.startswith("ubuntu"):
image_tag = image_tag[:-2] + "." + image_tag[-2:]

quay_name = os.getenv("CONTAINER_REGISTRY_URL", default="quay.io/mariadb-foundation/bb-worker:") + image_tag
if builder.startswith("x86"):
os_name += "-i386"
quay_name += "-386"

base_name, name, worker_instance = createWorker(
worker_name,
worker_id,
os_name,
quay_name,
jobs=jobs,
save_packages=True,
shm_size="15G",
)
print(base_name)

workers[base_name].append(name)
c["workers"].append(worker_instance)

workers[base_name].append(name)
c["workers"].append(worker_instance)
print('WORKERS LOADED: ', workers)

####### FACTORY CODE

Expand Down Expand Up @@ -228,82 +237,63 @@ f_deb_autobake.addStep(
####### BUILDERS LIST

c["builders"] = []
print('workers: ', workers)

for builder in master_config["builders"]:
splits = builder.split("-")
arch = splits[0]
os_name = "-".join(splits[1:])
for arch in master_config["builders"]:
builders_group = master_config["builders"][arch]
print('Builders group: ', builders_group)
for os_name in builders_group:
worker_prefix = arch
worker_suffix = ''

if arch == "amd64":
arch = "x64"
worker_name = arch + "-bbw-docker-" + os_name
if arch == "amd64":
worker_prefix = "x64"

if arch == "x86":
worker_name = "x64-bbw-docker-" + os_name + "-i386"
if arch == "x86":
worker_prefix = 'x64'
worker_suffix = '-i386'
worker_name = f'{worker_prefix}-bbw-docker-{os_name}{worker_suffix}'

build_type = os_info[os_name]["type"]
build_type = os_info[os_name]["type"]

builder = f'{arch}-{os_name}'
print('builder: ', builder)
print(f'Looking for builder the worker: {worker_name}')

# Add builder only if it's not a protected branches one
if builder not in GITHUB_STATUS_BUILDERS:
tags = [os_name]
if arch == "s390x" and builder in BUILDERS_GALERA_MTR:
tags += ["experimental"]
if "sid" in builder or "stream-9" in builder:
tags += ["bleeding-edge"]
# Add builder only if it's not a protected branches one
if builder not in GITHUB_STATUS_BUILDERS:
c["builders"].append(
util.BuilderConfig(
name=builder,
workernames=workers[worker_name],
tags=tags,
collapseRequests=True,
nextBuild=nextBuild,
canStartBuild=canStartBuild,
locks=getLocks,
factory=f_quick_build,
)
)

factory_instance = f_deb_autobake if build_type != "rpm" else f_rpm_autobake
properties = {
"verbose_build": "VERBOSE=1" if arch == "ppc4le" else None,
"rpm_type": "".join(os_name.split("-")) if build_type == "rpm" else None
}

tags += [build_type, "autobake"]

c["builders"].append(
util.BuilderConfig(
name=builder,
name=builder + "-" + build_type + "-autobake",
workernames=workers[worker_name],
tags=tags,
collapseRequests=True,
nextBuild=nextBuild,
canStartBuild=canStartBuild,
locks=getLocks,
factory=f_quick_build,
properties=properties,
factory=factory_instance,
)
)

factory_instance = f_deb_autobake
properties = {}

if arch == "ppc64le":
properties["verbose_build"] = "VERBOSE=1"
if build_type == "rpm":
properties["rpm_type"] = "".join(os_name.split("-"))
factory_instance = f_rpm_autobake
tags = [os_name, build_type, "autobake"]
# From mariadb.org-tools/release/prep - under
# Dirs for buildbot.mariadb.org
if builder in [
"aarch64-openeuler-2403",
"amd64-openeuler-2403",
"s390x-ubuntu-2004",
"s390x-rhel-8",
"s390x-sles-15",
"ppc64le-rhel-9",
"s390x-rhel-9",
"ppc64le-ubuntu-2204",
"s390x-ubuntu-2204",
"amd64-debian-sid",
"aarch64-debian-sid",
"ppc64le-debian-sid",
"amd64-opensuse-1505",
"amd64-opensuse-1506",
"amd64-sles-1505",
"s390x-sles-1505",
]:
tags += ["release_packages"]
c["builders"].append(
util.BuilderConfig(
name=builder + "-" + build_type + "-autobake",
workernames=workers[worker_name],
tags=tags,
collapseRequests=True,
nextBuild=nextBuild,
canStartBuild=canStartBuild,
locks=getLocks,
properties=properties,
factory=factory_instance,
)
)

Loading

0 comments on commit 665f5e4

Please sign in to comment.