-
Notifications
You must be signed in to change notification settings - Fork 787
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
Use --arch and --os options to select architecture and os #2868
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0c0b715
to
056ba46
Compare
docs/buildah-pull.md
Outdated
|
||
Set the ARCH of the image to the provided value instead of using the architecture of the host. | ||
|
||
**--arch**="ARCH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've got this entry twice.
docs/buildah-pull.md
Outdated
@@ -70,6 +78,10 @@ The [key[:passphrase]] to be used for decryption of images. Key can point to key | |||
|
|||
If an image needs to be pulled from the registry, suppress progress output. | |||
|
|||
**--os**="OS" | |||
|
|||
Set the OS of the image to be pulled to the provided value instead of using the current operating system of the host. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Examples?
1b14dde
to
809a09f
Compare
515f610
to
8e45ae4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This breaks any pre-existing users of the
--override-
* flags. If that is intentional, nothing in this PR records why, and that rationale will be impossible to reconstruct. - This was linked from
arch: arm
instead ofarch: arm32v7
implies official images need to be referenced by archtecture explicitely #2873 as “helping fix this”, I can’t see that it does.arch: arm
instead ofarch: arm32v7
implies official images need to be referenced by archtecture explicitely #2873 (supposedly) fails because defaulting OS/arch toruntime.GO*
values turns off autodetection (including variant autodetection), and this PR AFAICS changes nothing about that.
@mtrmac I setup aliases for --override-arch -> --arch and --override-os -> --os So existing users should not be broken and these options were never documented. |
This PR allows the specification of the variant, which was one of the requested changes in that issue, I believe. |
Ah, my mistake. Thanks.
Ah, OK. The PR description doesn’t say, and I have missed that. Letting the user manually specify a variant provides a workaround; the way c/image works, removing the defaulting to |
@mtrmac Added a second patch to stop defaulting the OS and Arch if the user did not specify it. Is this what you meant? |
@rhatdan tests aren't hip and you need a rebase |
|
||
if selectedOS, err := c.Flags().GetString("os"); err == nil && selectedOS != runtime.GOOS { | ||
os = selectedOS | ||
if c.Flag("os").Changed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This does not change
SystemContextFromOptions
- From a very quick skim, the results of this function are used to set the OS/arch inside the built image, and not passed to c/image at all. That probably should have some default.
- It seems easier to follow to me to not have the
runtime.GO*
defaults for flag values (incmd/buildah/
) specified, if they are going to be ignored here, and if this function hard-codes a default anyway.
Disclaimer: This is based on a very cursory skim, I don’t understand the code base and data flow at all well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of the defaults is the buildah --help information shows them
$ ./bin/buildah from --help | grep -- --os
--os OS prefer OS instead of the running OS when pulling images (default "linux")
$ ./bin/buildah from --help | grep -- --arch
--arch string set the ARCH of the image to the provided value instead of the architecture of the host (default "amd64")
The SystemContextFromOptions is a good point, and I added the .Changed check there as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, but it’s not the default if no --os
and --os=$default
behave differently.
It is also possible to embed that value into the flag description instead.
The change of the default return value of PlatformFromOptions
still looks wrong to me, but I’ll leave that to Buildah experts.
Remove --override-os and --override-arch flags. Also use --platform option if specified when generating the SystemContext. Conflict --platform option with --os, --arch and --variant options. Signed-off-by: Daniel J Walsh <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
@mtrmac @TomSweeneyRedHat Tests are passing and I think I addressed @mtrmac concerns. We need to get this merged so I can continue on the manifests PR. |
LGTM |
@containers/podman-maintainers PTAL |
@vrothberg PTAL |
LGTM |
Remove --override-os and --override-arch flags.
Signed-off-by: Daniel J Walsh [email protected]
What type of PR is this?
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?