-
Notifications
You must be signed in to change notification settings - Fork 16
Buildx builders #214
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
Merged
Merged
Buildx builders #214
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| ================== | ||
| Builders Example | ||
| ================== | ||
|
|
||
| This example demonstrates how to use Buildrunner with custom builders and random builder selection. | ||
|
|
||
| Platform Builders Configuration | ||
| =============================== | ||
|
|
||
| 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. | ||
|
|
||
| Configuration Options | ||
| --------------------- | ||
|
|
||
| 1. **Multiple builders per platform** (recommended for load balancing): | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| platform-builders: | ||
| linux/amd64: | ||
| - builder1 | ||
| - builder2 | ||
| - builder3 | ||
| linux/arm64: | ||
| - builder4 | ||
| - builder5 | ||
|
|
||
| 2. **Single builder per platform**: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| platform-builders: | ||
| linux/amd64: builder1 | ||
| linux/arm64: builder2 | ||
|
|
||
|
|
||
| Random Selection | ||
| ---------------- | ||
|
|
||
| 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. | ||
|
|
||
| How to Run | ||
| ========== | ||
|
|
||
| 1. **Create builders** | ||
|
|
||
| From the base directory, run: | ||
|
|
||
| .. code-block:: sh | ||
|
|
||
| python examples/build/builders/create_builders.sh | ||
|
|
||
| 2. **Run build with example configuration file** | ||
|
|
||
| From the base directory, run the following command: | ||
|
|
||
| .. code-block:: sh | ||
|
|
||
| ./run-buildrunner.sh -f examples/build/builders/buildrunner.yaml -c examples/build/builders/global-config.yaml | ||
|
|
||
| or | ||
|
|
||
| .. code-block:: sh | ||
|
|
||
| ./run-buildrunner.sh -f examples/build/builders/buildrunner.yaml -c examples/build/builders/global-config-list.yaml | ||
|
|
||
| 3. **Remove builders** | ||
|
|
||
| From the base directory, run: | ||
|
|
||
| .. code-block:: sh | ||
|
|
||
| python examples/build/builders/remove_builders.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Example of a buildrunner.yaml file that specifies a multi-platform build step in order to test the builders. | ||
|
|
||
| # Execute using: | ||
| # ./run-buildrunner.sh -f examples/build/builders/buildrunner.yaml -c examples/build/builders/global-config-list.yaml | ||
|
|
||
| steps: | ||
| multi-platform-build-step: | ||
| build: | ||
| dockerfile: | | ||
| FROM alpine:latest | ||
| LABEL custom_label="Buildrunner example label" | ||
| platforms: | ||
| - linux/arm/v6 | ||
| - linux/arm/v7 | ||
| - linux/arm/v8 | ||
| - linux/arm64 | ||
| - linux/arm64/v8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/bin/bash | ||
|
|
||
| docker buildx create --name builder1 --driver docker-container --bootstrap | ||
| docker buildx create --name builder2 --driver docker-container --bootstrap | ||
| docker buildx create --name builder3 --driver docker-container --bootstrap | ||
|
|
||
| docker buildx ls --debug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # This is a global configuration file that lists the builders for each platform. | ||
| platform-builders: | ||
| linux/arm/v6: | ||
| - builder1 | ||
| - builder2 | ||
| - builder3 | ||
| linux/arm/v7: | ||
| - builder1 | ||
| - builder2 | ||
| - builder3 | ||
| linux/arm/v8: | ||
| - builder1 | ||
| - builder2 | ||
| - builder3 | ||
| linux/arm64: | ||
| - builder1 | ||
| - builder2 | ||
| - builder3 | ||
| linux/arm64/v8: | ||
| - builder1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
| platform-builders: | ||
| linux/arm/v6: builder1 | ||
| linux/arm/v7: builder2 | ||
| linux/arm/v8: builder3 | ||
| linux/arm64: builder1 | ||
| linux/arm64/v8: builder2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| docker buildx rm builder1 | ||
| docker buildx rm builder2 | ||
| docker buildx rm builder3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not possible to track/do round robin, so I think this will work great