Skip to content

Commit 101314f

Browse files
committed
Update docs
1 parent 9b4ef40 commit 101314f

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

buildrunner/docker/multiplatform_image_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(
7777
docker_registry: Optional[str] = None,
7878
build_registry: Optional[str] = MP_LOCAL_REGISTRY,
7979
temp_dir: str = os.getcwd(),
80-
platform_builders: Optional[Dict[str, str]] = None,
80+
platform_builders: Optional[Union[Dict[str, List[str]], List[str]]] = None,
8181
cache_builders: Optional[List[str]] = None,
8282
cache_from: Optional[Union[dict, str]] = None,
8383
cache_to: Optional[Union[dict, str]] = None,

docs/global-configuration.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,16 @@ they are used when put into the global configuration file:
9999
# and therefore this must be configured in buildrunner itself to perform builds
100100
# across multiple builders for different platforms. Any platform not specified
101101
# here will use the default configured buildx builder.
102+
#
103+
# Each platform can be configured with either a single builder (string) or
104+
# a list of builders (array of strings). When using a list, buildrunner will
105+
# randomly select one builder for each build.
102106
platform-builders:
103107
platform1: builder1
108+
platform2:
109+
- builder1
110+
- builder2
111+
- builder3
104112
105113
# Configures caching *for multi-platform builds only*
106114
docker-build-cache:

examples/build/builders/README.rst

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,42 @@
22
Builders Example
33
==================
44

5-
This example demonstrates how to use Buildrunner with custom builders.
5+
This example demonstrates how to use Buildrunner with custom builders and random builder selection.
6+
7+
Platform Builders Configuration
8+
===============================
9+
10+
The ``platform-builders`` configuration allows you to specify which builders to use for different platforms. When multiple builders are available for a platform, Buildrunner will randomly select one to distribute the load.
11+
12+
Configuration Options
13+
---------------------
14+
15+
1. **Multiple builders per platform** (recommended for load balancing):
16+
17+
.. code-block:: yaml
18+
19+
platform-builders:
20+
linux/amd64:
21+
- builder1
22+
- builder2
23+
- builder3
24+
linux/arm64:
25+
- builder4
26+
- builder5
27+
28+
2. **Single builder per platform**:
29+
30+
.. code-block:: yaml
31+
32+
platform-builders:
33+
linux/amd64: builder1
34+
linux/arm64: builder2
35+
36+
37+
Random Selection
38+
----------------
39+
40+
When multiple builders are configured for a platform, Buildrunner will randomly select one builder for each build. This helps distribute the build load across available builders and can improve build performance by utilizing multiple build resources.
641

742
How to Run
843
==========
@@ -23,13 +58,12 @@ How to Run
2358
2459
./run-buildrunner.sh -f examples/build/builders/buildrunner.yaml -c examples/build/builders/global-config.yaml
2560
26-
or
61+
or
2762

2863
.. code-block:: sh
2964
3065
./run-buildrunner.sh -f examples/build/builders/buildrunner.yaml -c examples/build/builders/global-config-list.yaml
3166
32-
3367
3. **Remove builders**
3468

3569
From the base directory, run:

tests/test_config_validation/test_global_config.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,26 @@ def fixture_override_master_config_file(tmp_path):
134134
(
135135
"""
136136
platform-builders:
137-
linux/amd64: builder2
138-
linux/arm64: builder3
137+
linux/amd64: builder1
138+
linux/arm64: builder2
139139
""",
140140
[],
141141
),
142142
(
143143
"""
144144
platform-builders:
145+
linux/amd64: builder1
146+
linux/arm64:
147+
- builder1
148+
- builder2
149+
""",
150+
[],
151+
),
152+
(
153+
"""
154+
platform-builders:
155+
- builder1
145156
- builder2
146-
- builder3
147157
""",
148158
["platform-builders: Input should be a valid dictionary (dict_type)"],
149159
),

0 commit comments

Comments
 (0)