Skip to content

Concerning mutil arch builds #651

@cidrblock

Description

@cidrblock

Using a simple starting point:

---
version: 3

dependencies:
  ansible_core:
    package_pip: ansible-core==2.16.3
  ansible_runner:
    package_pip: ansible-runner
  python_interpreter:
    package_system: "python3.12"

images:
  base_image:
    name: registry.fedoraproject.org/fedora-minimal:39

options:
  package_manager_path: /usr/bin/microdnf

multi-arch can be accomplished with:

$ ansible-builder create                                                                           
Complete! The build context can be found at: /home/bthornto/github/builder-march/context
$ podman manifest create ee-test
$ podman build --platform linux/amd64,linux/arm64  --manifest ee-test -f context/Containerfile
$ podman manifest inspect ee-test | grep 'arch\|digest'
            "digest": "sha256:969841c4a366c835c8a0ddf28688487bf29b363af1b9853e8d8b3c6860576a1c",
                "architecture": "arm64",
            "digest": "sha256:4068e51486c0d89313c3542b5b21e9e8a15a7b83d4937db3983f498471045600",
                "architecture": "amd64",
$ podman images --digests | grep '6a1c\|5600'         
<none>                                     <none>      sha256:4068e51486c0d89313c3542b5b21e9e8a15a7b83d4937db3983f498471045600  d2f04819aabd  10 minutes ago  250 MB
<none>                                     <none>      sha256:969841c4a366c835c8a0ddf28688487bf29b363af1b9853e8d8b3c6860576a1c  e08bdf83069c  10 minutes ago  335 MB

Later pushing as needed podman manifest push ee-test

Some questions come to mind:

  1. Can it be assumed the resulting images are configured in the same manner they would be had ansible-builder build been used instead? (Are there any reasons to not do the above when a multi-arch is needed?)
  2. Is there an opportunity here for the user to provide an alternative to the built-in "build" command https://github.com/ansible/ansible-builder/blob/devel/src/ansible_builder/main.py#L189 If supported in the execution-environment.yml file it could be used later or shared to rebuild in the same manner if needed. (the tag and manifest keywords would need to be account for) If supplied as podman/docker specific this could acount for buildx.
  3. (if not) Can we document the above approach in a FAQ or examples section of the docs? What would be the best place? (happy to PR)

thank again for all the builder work, everytime I use it I reappreciate how handy it is.

-brad

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions