buildah icon indicating copy to clipboard operation
buildah copied to clipboard

--all-platforms is not reproducible

Open ShuP1 opened this issue 3 months ago • 2 comments

Issue Description

Order of platforms found by buildah build --all-platforms is undeterministic. So even with reproducible layers, manifest is different

Return from platformsForBaseImages https://github.com/containers/buildah/blob/main/imagebuildah/build.go#L546 should be sorted

Steps to reproduce the issue

Steps to reproduce the issue 1.

FROM docker.io/library/alpine:3@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1

RUN touch force-layer
  1. buildah build --all-platforms --source-date-epoch 0 --rewrite-timestamp image:a
  2. buildah build --all-platforms --source-date-epoch 0 --rewrite-timestamp image:b NOTE: building order is undetermistic too
  3. diffoci diff image:a image:b
INFO[0000] Target platforms: [linux/amd64]
TYPE    NAME                                       INPUT-0                                                             INPUT-1
Desc    application/vnd.oci.image.index.v1+json    7939a9245924c0cd5ac7c518c618cf97ffc3bf7dbfb4a4267017dd747f44e116    48e20112a4f5251ea5cf16e7f8644a36f543f11689f40761bae393f829e8e344
Idx     ctx:/index    
  1. skopeo inspect docker://image:a --no-tags --raw & same with image:b then diff

Describe the results you received

Got same platform specific images but in a different order

      "digest": "sha256:adadbfeeeab445f90e1cc7196fd25d04b26e3 |       "digest": "sha256:ea3fbdb5467db5217cb67edb39b66babab083
      "size": 1263,                                           |       "size": 1259,
        "architecture": "ppc64le",                            |         "architecture": "s390x",
      "digest": "sha256:ea3fbdb5467db5217cb67edb39b66babab083 |       "digest": "sha256:ac3bb35b8396a4ce2a3d1c4c4c419662cd45b
      "size": 1259,                                           |       "size": 1263,
        "architecture": "s390x",                              |         "architecture": "riscv64",
      "digest": "sha256:f74363c7f07deb733f575760f5322eba9a67e |       "digest": "sha256:adadbfeeeab445f90e1cc7196fd25d04b26e3
      "size": 1261,                                           |       "size": 1263,
        "architecture": "arm",                                |         "architecture": "ppc64le",
        "os": "linux",                                        |         "os": "linux"
        "variant": "v7"                                       <
      "digest": "sha256:e0107b96fa2e7f192c5dccd560754d47808ca |       "digest": "sha256:17e4fd41550a699fb1c02e24931ec935409f6
      "size": 1256,                                           |       "size": 1263,
        "architecture": "386",                                |         "architecture": "arm64",
        "os": "linux"                                         |         "os": "linux",
                                                              >         "variant": "v8"
      "digest": "sha256:ac3bb35b8396a4ce2a3d1c4c4c419662cd45b |       "digest": "sha256:f74363c7f07deb733f575760f5322eba9a67e
      "size": 1263,                                           |       "size": 1261,
        "architecture": "riscv64",                            |         "architecture": "arm",
        "os": "linux"                                         |         "os": "linux",
                                                              >         "variant": "v7"
      "digest": "sha256:17e4fd41550a699fb1c02e24931ec935409f6 |       "digest": "sha256:e0107b96fa2e7f192c5dccd560754d47808ca
      "size": 1263,                                           |       "size": 1256,
        "architecture": "arm64",                              |         "architecture": "386",
        "os": "linux",                                        |         "os": "linux"
        "variant": "v8"                                       <

Describe the results you expected

Order should be determistic. So manifest could be reproducible

buildah version output

Version:         1.41.3
Go Version:      go1.24.6
Image Spec:      1.1.1
Runtime Spec:    1.2.1
CNI Spec:        1.1.0
libcni Version:  
image Version:   5.36.1
Git Commit:      
Built:           Thu Aug 14 19:19:43 2025
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64

buildah info output

GitLab Runner

Using docker image quay.io/containers/buildah:v1

ShuP1 avatar Sep 11 '25 14:09 ShuP1

Might be as simple as https://github.com/containers/buildah/compare/main...ShuP1:buildah:patch-1

ShuP1 avatar Sep 11 '25 14:09 ShuP1

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Oct 12 '25 00:10 github-actions[bot]