coreos / coreos-assembler

Tooling container to assemble CoreOS-like systems
https://coreos.github.io/coreos-assembler/
Apache License 2.0
348 stars 168 forks source link

`cosa buildfetch --build` followed by `cosa build` errors out #2870

Open miabbott opened 2 years ago

miabbott commented 2 years ago

Bug Report

Environment

What operating system is being used to run coreos-assembler?

Fedora 35 SB

What operating system is being assembled?

FCOS 36 testing-devel

Is coreos-assembler running in Podman or Docker?

podman

If Podman, is coreos-assembler running privileged or unprivileged?

unprivileged

Expected Behavior

Successful build of FCOS

Actual Behavior

Committing... done
Metadata Total: 8925
Metadata Written: 3016
Content Total: 6475
Content Written: 1468
Content Cache Hits: 16388
Content Bytes Written: 139680221
3016 metadata, 19658 content objects imported; 1.4 GB content written                                                                                                                                                                                           
fedora/x86_64/coreos/testing-devel => 8f6b0bd330a23745cb82012fc803dac3fe020ac86b11437edaacfe64dce55e3d
New image input checksum: 768a3a37b5064dbc7c460fe693834200373d7f250402ceafa6b0f6fe748de7ee
Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "/usr/lib/coreos-assembler/cosalib/builds.py", line 134, in init_build_meta_json
    with open(metapath) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/srv/builds/36.20220520.20.0/x86_64/meta.json'

In this case, 36.20220520.20.0 is the most recent build ID available from testing-devel.

Reproduction Steps

  1. cosa init https://github.com/coreos/fedora-coreos-config
  2. cosa buildfetch --build 36.20220516.20.1 --url s3://fcos-builds/prod/streams/testing-devel/builds
  3. cosa fetch && cosa build

Other Information

Not sure if this should be strictly supported, since cosa build has the --parent-build option. But we should probably more gracefully handle this condition.

Also of note, if cosa build --parent-build is used, we don't get the pkg diff between the two commits:

Committing... done
Metadata Total: 8925
Metadata Written: 16
Content Total: 6474
Content Written: 12
Content Cache Hits: 16389
Content Bytes Written: 104138319
16 metadata, 12 content objects imported; 104.1 MB content written                                                                                                                                                                                             
fedora/x86_64/coreos/testing-devel => bbd835bab6555ca55f06995243764f565eacb88458eec88cb6abe21721c1c9ae
New image input checksum: b73c78cd6fac8ff5b95595391cb653a21712ae84655c0c569de73c87467a1124
None
New build ID: 36.20220521.dev.3
Running:  ostree container encapsulate --copymeta=rpmostree.inputhash --repo=/srv/tmp/repo --label=coreos-assembler.image-config-checksum=5e91c8035ea0739c88e5b3cbe5e11fb2d3742c621559d6503f1f6f09d35bebea --label=coreos-assembler.image-input-checksum=b73c78cd6fac8ff5b95595391cb653a21712ae84655c0c569de73c87467a1124 --label=org.opencontainers.image.source=https://github.com/coreos/fedora-coreos-config --label=org.opencontainers.image.revision=6181d7f2a61d5426b78575804f82fa1867204899 36.20220521.dev.3 oci-archive:fedora-coreos-36.20220521.dev.3-ostree.x86_64.ociarchive.tmp:latest
sha256:fdf8400222776529f6538e35a539d695dd0592501d5c4610617b793e483dbf2d
Total objects: 22965
Deleted 84 objects, 279.0 MB freed
Ignoring non-directory /srv/builds/.build-commit
mtalexan commented 1 year ago

cosa build --parent-build=36.20220516.20.1 also would not work in your case.
The --parent/--parent-build both require the tmp/repo ostree to already have the specified build-id as a reference, but there is currently no supported mechanism in coreos-assembler to do that other than to previously have built that reference in the same workspace.