Accurate architectures and image matching#198
Merged
idroz merged 11 commits intobravetools:masterfrom Nov 18, 2022
Merged
Conversation
reported arch will now be the arch stored by bravetools going forwards rather than the reported GOARCH of bravetools host machine. This improves compatability with LXD and fixes issues when using remote machines with a different arch to build images.
…ry provided field and only resort to * when the field is missing. In addition, `ToBasename` returns to a simple string join of all fields to preserve all info when creating a new image
…matching the (potentially incomplete) image definition. Sometimes you need the exact result and other times you want any potential match
…tag whenever creating/importing a new image (not when querying for existing images). Fixes issues with inability to specifically select images with an empty string in version field if another image exists - empty strings would be replaced with stars and match all images with that name. Also cleanup field handling in `TransferImage` to match `buildImage` and do a specific check for image filename first before resorting to glob matching.
…ould result in an empty name field for imported image
…en attempting to parse using legacy Bravefile syntax - fixes image deletion and local image retrieval
…r arch when LXD api.Image is resolved
…within arch name are now supported
…if the image is the wrong arch
…itecture for image (for when arch is not specified)
This file contains hidden or 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
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.
Image architectures
This PR changes the way bravetools stores image architectures to align with the architectures reported by the build LXD server. This also addresses issues caused when using a remote build server that is a different architecture than the bravetools host.
Prior to this change, image architectures would be dervied from the runtime.GOARCH. For example: amd64/arm64.
After this change the LXD server reported value will be used. For example: x86_64/armv6l.
Image version "untagged" by default
Previously bravetools used version "1.0" as a default, but this was arbitrary and could be confusing if the user actually specified 1.0 themselves. The "untagged" version makes it clearer that it is not user-provided and avoids potential conflicts.
Image matching
This PR also adds image matching where partially defined images will be matched in certain cases. This allows the user to specify images via shorthand by excluding the version/architecture field. So long as only one possible image matches the image description the image will be matched. In cases where there are multiple possible matching images an error will be raised.
For example: