Skip to content

Commit

Permalink
Merge pull request adobe#58 from shanejbrown/main
Browse files Browse the repository at this point in the history
Change multi-platform config to use platforms
  • Loading branch information
shanejbrown authored Aug 16, 2023
2 parents c0d9744 + 42119ac commit 6487b9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,9 @@ shows the different configuration options available:
# To build multi-platform images, add each platform to be built to this list and buildrunner
# will use docker buildx to build and provide a single tag containing all architectures specified.
# Note that buildx may be configured to build some platforms with emulation and therefore builds
# may take longer with this option specified.
platform:
# may take longer with this option specified. Also note that when using the platforms option, it is not
# valid to also specify the platform option.
platforms:
- linux/amd64
- linux/arm64/v8
Expand Down
10 changes: 6 additions & 4 deletions buildrunner/steprunner/tasks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
self.buildargs = {}
self._import = None
self.platform = None
self.platforms = None

pull_from_config = None
if not is_dict(self.config):
Expand All @@ -59,6 +60,7 @@ def __init__(
self.nocache = self.config.get('no-cache', self.nocache)
pull_from_config = self.config.get('pull')
self.platform = self.config.get('platform', self.platform)
self.platforms = self.config.get('platforms', self.platforms)

if not is_dict(self.config.get('buildargs', self.buildargs)):
raise BuildRunnerConfigurationError(
Expand Down Expand Up @@ -211,18 +213,18 @@ def run(self, context):
docker_registry=docker_registry,
)
try:
if isinstance(self.platform, list) and len(self.platform) > 1:
if self.platforms:
built_images = self.step_runner.multi_platform.build_multiple_images(
platforms=self.platform,
platforms=self.platforms,
path=self.path,
file=self.dockerfile,
name=self.get_unique_build_name(),
docker_registry=docker_registry,
)

assert len(built_images) == len(self.platform), \
assert len(built_images) == len(self.platforms), \
f'Number of built images ({len(built_images)}) does not match ' \
f'the number of platforms ({len(self.platform)})'
f'the number of platforms ({len(self.platforms)})'

else:
exit_code = builder.build(
Expand Down

0 comments on commit 6487b9f

Please sign in to comment.