-
Notifications
You must be signed in to change notification settings - Fork 122
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
Make solving multi-architecture aware #1180
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Jon Johnson <[email protected]>
imjasonh
approved these changes
Jun 25, 2024
When building an image with multiple architectures, we now disqualify any packages that aren't available on every architecture. An example given wolfi trying to solve for `trivy=0.36.1-r2`, which was only built for arm64, probably because there was a bug in the build that was fixed in a subsequent epoch: for arch "arm64": installing apk packages: error getting package dependencies: solving "trivy=0.36.1-r2" constraint: ... trivy-0.36.1-r2.apk disqualified because package "trivy-0.36.1-r2.apk" not available for arch "amd64" Signed-off-by: Jon Johnson <[email protected]>
jonjohnsonjr
added a commit
to jonjohnsonjr/apko
that referenced
this pull request
Jul 10, 2024
In the terraform module, we call BuildPackageList for each arch: https://github.com/chainguard-dev/terraform-provider-apko/blob/812478b999411c183e87fefb9a9ece9fe7e8f2c1/internal/provider/config_data_source.go#L239 And then use that package list to actually build the image, so we separate the solving from the building. This bypasses chainguard-dev#1180 which does this multi-arch constraining through a different entrypoint. This adds another method to the multi-arch stuff that we can opt into for just the solve part. Signed-off-by: Jon Johnson <[email protected]>
jonjohnsonjr
added a commit
to jonjohnsonjr/apko
that referenced
this pull request
Jul 10, 2024
In the terraform module, we call BuildPackageList for each arch: https://github.com/chainguard-dev/terraform-provider-apko/blob/812478b999411c183e87fefb9a9ece9fe7e8f2c1/internal/provider/config_data_source.go#L239 And then use that package list to actually build the image, so we separate the solving from the building. This bypasses chainguard-dev#1180 which does this multi-arch constraining through a different entrypoint. This adds another method to the multi-arch stuff that we can opt into for just the solve part. Signed-off-by: Jon Johnson <[email protected]>
jonjohnsonjr
added a commit
to jonjohnsonjr/apko
that referenced
this pull request
Jul 10, 2024
In the terraform module, we call BuildPackageList for each arch: https://github.com/chainguard-dev/terraform-provider-apko/blob/812478b999411c183e87fefb9a9ece9fe7e8f2c1/internal/provider/config_data_source.go#L239 And then use that package list to actually build the image, so we separate the solving from the building. This bypasses chainguard-dev#1180 which does this multi-arch constraining through a different entrypoint. This adds another method to the multi-arch stuff that we can opt into for just the solve part. Signed-off-by: Jon Johnson <[email protected]>
jonjohnsonjr
added a commit
that referenced
this pull request
Jul 10, 2024
In the terraform module, we call BuildPackageList for each arch: https://github.com/chainguard-dev/terraform-provider-apko/blob/812478b999411c183e87fefb9a9ece9fe7e8f2c1/internal/provider/config_data_source.go#L239 And then use that package list to actually build the image, so we separate the solving from the building. This bypasses #1180 which does this multi-arch constraining through a different entrypoint. This adds another method to the multi-arch stuff that we can opt into for just the solve part. To demonstrate this, I made `show-packages` use it: ``` diff --git a/examples/wolfi-base.yaml b/examples/wolfi-base.yaml index d3ca2b8..0f0e979 100644 --- a/examples/wolfi-base.yaml +++ b/examples/wolfi-base.yaml @@ -4,7 +4,7 @@ contents: repositories: - https://packages.wolfi.dev/os packages: - - wolfi-base + - trivy~0.36.1 ``` Before: ``` $ apko show-packages ./examples/wolfi-base.yaml 2024/07/10 13:06:01 INFO Determining packages for 2 architectures: [amd64 arm64] 2024/07/10 13:06:01 INFO setting apk repositories: [https://packages.wolfi.dev/os] arch=x86_64 2024/07/10 13:06:01 INFO using working directory /var/folders/96/3cdgttts3698hyjg_tydpw5c0000gn/T/apko-2043974002/x86_64 arch=x86_64 2024/07/10 13:06:01 INFO finished gathering apk info arch=x86_64 trivy 0.36.1-r1 2024/07/10 13:06:01 INFO setting apk repositories: [https://packages.wolfi.dev/os] arch=aarch64 2024/07/10 13:06:01 INFO using working directory /var/folders/96/3cdgttts3698hyjg_tydpw5c0000gn/T/apko-2043974002/aarch64 arch=aarch64 2024/07/10 13:06:01 INFO finished gathering apk info arch=aarch64 trivy 0.36.1-r2 ``` After: ``` $ apko show-packages ./examples/wolfi-base.yaml 2024/07/10 13:06:25 INFO Determining packages for 2 architectures: [amd64 arm64] 2024/07/10 13:06:25 INFO setting apk repositories: [https://packages.wolfi.dev/os] 2024/07/10 13:06:25 INFO setting apk repositories: [https://packages.wolfi.dev/os] 2024/07/10 13:06:25 INFO packages for arm64 trivy 0.36.1-r1 2024/07/10 13:06:25 INFO packages for amd64 trivy 0.36.1-r1 ``` I am using `trivy~0.36.1` as a constraint because we never indexed `trivy-0.36.1-r2.apk` on `x86_64`, which means we'd solve for different packages on each arch without this change. Signed-off-by: Jon Johnson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When building an image with multiple architectures, we now disqualify any packages that aren't available on every architecture.
An example given wolfi trying to solve for
trivy=0.36.1-r2
, which was only built for arm64, probably because there was a bug in the build that was fixed in a subsequent epoch: