Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

container: include the architecture of the image in container.Spec #585

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

mvo5
Copy link
Contributor

@mvo5 mvo5 commented Apr 12, 2024

This is a different attempt to resolve the issue that the resolver consider the requested architecture more of a "hint". The initial attempt is in #451 but it caused some issues as this seems to be expected behavior of the library in tests at least.

So this commit is more conservative and just includes the the architecture in the container.Spec so that the consumer of the library can inspect and error on mismatch of requested arch and resolved arch.

With that in bib we can check the arch, I outlined this in https://github.com/osbuild/bootc-image-builder/compare/main...mvo5:check-resolved-image-arches?expand=1 what we could have to do there (plus some other changes because the image API has changed quite a bit and a go.mod change to make it trivial to test locally but that will need adjustment of course).

@kingsleyzissou
Copy link
Contributor

I like it :)

@mvo5 mvo5 marked this pull request as ready for review April 12, 2024 13:01
@mvo5 mvo5 requested a review from ondrejbudai April 12, 2024 13:01
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 12, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
Copy link
Contributor

@kingsleyzissou kingsleyzissou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this!

Will wait for an additional review

This is a different attempt to resolve the issue that the resolver
consider the requested architecture more of a "hint". The initial
attempt is in osbuild#451 but
it caused some issues as this seems to be expected behavior of
the library in tests at least.

So this commit is more conservative and just includes the the
architecture in the `container.Spec` so that the consumer of
the library can inspect and error on mismatch of requested
arch and resolved arch.
This is needed to compare an arch to an unset type.
The way architectures can be confusing, the images library is
using the kernel types internally, i.e. X86_64. However the
container libraries seem to use the golang names (e.g. `amd64`).

To avoid the confusing use `arch.Arch` consitently which can
ingest the go names.
@achilleas-k achilleas-k added this pull request to the merge queue Apr 15, 2024
Merged via the queue into osbuild:main with commit 3fef7c6 Apr 15, 2024
14 of 16 checks passed
@mvo5 mvo5 deleted the include-arch-in-spec branch April 15, 2024 17:41
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 18, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 18, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 18, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 18, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 18, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 18, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
github-merge-queue bot pushed a commit to osbuild/bootc-image-builder that referenced this pull request Apr 23, 2024
When trying to build an image with an incompatible target arch
bib will currently not error because the container resolver is
not very strict about the architecture request.

This commit fixes this by double checking that the resolved
container is actually of the expected architecture.

This requires osbuild/images#585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants