diff --git a/builders/docker_builder.py b/builders/docker_builder.py new file mode 100644 index 00000000..c7dfe40a --- /dev/null +++ b/builders/docker_builder.py @@ -0,0 +1,47 @@ +from dataclasses import dataclass + +from buildbot.plugins import util + +from steps.base import BuildStep +from steps.containers import DockerConfig, StartContainerStep + + +@dataclass +class WorkerMachine(object): + arch: str + name: str + + + +@dataclass +class DistroDockerBuild: + name: str # Distro name, such as ubuntu, rhel + # Version number (such as 12 (Debian), 22.04 (Ubuntu), 8 (Rhel) + version: str + version_alias: str # Distro alias, such as Bookworm, Noble + docker_environment: DockerConfig # Runtime environment config + + tags: list[str] # List of tags, presented in the UI + # All the build steps the docker build must run. + buildsteps: list[BuildStep] + properties: dict[str, str] + + def __str__(self): + return f'DistroDockerBuild: {self.name}' + + def create_builder_factory(self) -> util.BuildFactory: + f = util.BuildFactory() + f.addStep(StartContainerStep(self.docker_environment).generate()) + f.addStep(FetchTarballStep().generate()) + f.addStep(ConfigureMariaDBStep(cmake).generate()) + f.addStep(CompileStep().generate()) + f.addStep(MTRStep().generate()) + f.addStep(StopContainerStep.generate()) + return f + ... + + def start_container_step(self) -> Build: + ... + + def stop_container(self): + ... diff --git a/builders/rpm.py b/builders/rpm.py new file mode 100644 index 00000000..f694e446 --- /dev/null +++ b/builders/rpm.py @@ -0,0 +1,2 @@ +class RPMBuilder: + pass diff --git a/steps/compile.py b/steps/compile.py index 2bbd1a4d..6e26a50e 100644 --- a/steps/compile.py +++ b/steps/compile.py @@ -1,3 +1,8 @@ +from buildbot.plugins import steps, util +from buildbot import interfaces + +from .base import BuildStep + class CompileMakeStep(BuildStep): def __init__(self, verbose: bool, include_package: bool): @@ -17,12 +22,11 @@ def generate(self) -> interfaces.IBuildStep: class CompileCMakeStep(BuildStep): - def __init__(self, verbose: bool, include_package: bool): - self.include_package = include_package + def __init__(self, verbose: bool): self.verbose = verbose def generate(self) -> interfaces.IBuildStep: - name = 'Compile - package' if self.include_package else 'Compile' + name = 'Compile' command = [ 'cmake', '--build' diff --git a/steps/containers.py b/steps/containers.py index bb31a850..17e050d0 100644 --- a/steps/containers.py +++ b/steps/containers.py @@ -1,3 +1,8 @@ +from dataclasses import dataclass + +from buildbot.plugins import steps, util +from buildbot import interfaces + from .base import BuildStep @@ -8,6 +13,7 @@ class DockerConfig: shm_size: str memlock_limit: int + class StartContainerStep(BuildStep): def __init__(self, config: DockerConfig): self.config = config @@ -21,19 +27,6 @@ def generate(self): ]) -class FetchTarballStep(BuildStep): - def __init__(self, url: str): - self.url = url - - def generate(self) -> interfaces.IBuildStep: - return steps.ShellCommand( - name="Fetch Source Tarball", - command=[ - 'bash', - '-ec', - 'get_tarball.sh', - util.Interpolate('%(prop:tarbuildnum)s'), - util.Interpolate('%(prop:mariadb_version)s'), - ] - ) - +class BaseCommandInContainer(BuildStep): + def __init__(self, container: DockerConfig, command: list[str]): + pass