redhat-actions / buildah-build

GitHub Action to use 'buildah' to build a container image.
https://github.com/marketplace/actions/buildah-build
MIT License
144 stars 34 forks source link

Multi-arch support #24

Closed lexfrei closed 3 years ago

lexfrei commented 3 years ago

Looks like the buildah can build multi-arch images: https://github.com/containers/buildah/issues/1590 Can we use it in this action?

divyansh42 commented 3 years ago

@lexfrei 👋🏻 I think support to build mult-arch images will be a good addition. We will update you once we start working on this feature :)

tetchel commented 3 years ago

is this just the -arch argument?

this user also points out you need to have qemu-user-static installed https://github.com/containers/buildah/issues/1590#issuecomment-771924743

divyansh42 commented 3 years ago

Hi @lexfrei this feature is now added in v2 version of the action.

anthr76 commented 3 years ago

Hi!

I'm trying to initiate a multi-arch build though it's failing.

My failed workflow can be found here

I have set.

    - name: Build Image
      id: build-image
      uses: redhat-actions/buildah-build@v2.2.1
      with:
        image: tumbleweed-dnf-toolbox
        tags: ${{ env.SHORT_SHA }} ${{ env.SNAPSHOT }} latest
        archs: amd64,ARM64
        oci: true
        context: images/opensuse/tw/dnf
        dockerfiles:
          ./images/opensuse/tw/dnf/Dockerfile

I can build just fine on the CLI like buildah bud --arch amd64,ARM64 -t anthr76-devops-toolbox:20210305 .

anthr76 commented 3 years ago

Hey there @tetchel !

Thanks for taking a look! This is interesting as I originally had that.

I now receive the error on the image from OpenSUSE's registry (registry.opensuse.org/opensuse/tumbleweed-dnf), but not on the image I layered!

  1. https://github.com/anthr76/tooling/runs/2047204867?check_suite_focus=true (fail)
  2. https://github.com/anthr76/tooling/runs/2047199421?check_suite_focus=true (pass)

Which an interesting pattern, of which I'm assuming is a Buildah bug or an issue with the SUSE image. Though the SUSE image is indeed multi-arch. This can actually be re-produced on the CLI with both casings of arm.

buildah bud --arch amd64,ARM64 -t tumbweed-toolbox-dnf:20210306 .                                                   
STEP 1: FROM registry.opensuse.org/opensuse/tumbleweed-dnf
error creating build container: Error choosing an image from manifest list docker://registry.opensuse.org/opensuse/tumbleweed-dnf:latest: no image found in manifest list for architecture amd64,ARM64, variant "", OS linux
ERRO exit status 12
tetchel commented 3 years ago

Sorry, I deleted my comment because I wanted to investigate further.

I wonder if the problem could be worked around by doing a buildah pull --arch with each arch you want, before doing the bud.

Another workaround worth trying is building the architectures separately (using a matrix strategy), ie one with --arch arm64 and another with --arch amd64.

anthr76 commented 3 years ago

I wonder if the problem could be worked around by doing a buildah pull --arch with each arch you want, before doing the bud

This worked (at least on the CLI)! Neat workaround. Wonder what exactly is causing this..

jayaddison commented 3 years ago

Hey folks :wave: Is there any chance that the buildah-build action might support the --platform multi-arch buildah option in future? (I can open a feature request if that's better than asking in here)

(as I understand it / for context: --platform is a way to provide --os, --arch and --variant within a single parameter, so it conflicts with those if they are set)

tetchel commented 3 years ago

@jayaddison https://github.com/redhat-actions/buildah-build/issues/65

jayaddison commented 3 years ago

Thanks, @tetchel!