Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cvicentiu committed Jan 1, 2025
1 parent 0225c7a commit c550a19
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 19 deletions.
47 changes: 47 additions & 0 deletions builders/docker_builder.py
Original file line number Diff line number Diff line change
@@ -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):
...
2 changes: 2 additions & 0 deletions builders/rpm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class RPMBuilder:
pass
10 changes: 7 additions & 3 deletions steps/compile.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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'
Expand Down
25 changes: 9 additions & 16 deletions steps/containers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from dataclasses import dataclass

from buildbot.plugins import steps, util
from buildbot import interfaces

from .base import BuildStep


Expand All @@ -8,6 +13,7 @@ class DockerConfig:
shm_size: str
memlock_limit: int


class StartContainerStep(BuildStep):
def __init__(self, config: DockerConfig):
self.config = config
Expand All @@ -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

0 comments on commit c550a19

Please sign in to comment.