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

Use --arch and --os options to select architecture and os #2868

Merged
merged 2 commits into from
Jan 6, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Dec 22, 2020

Remove --override-os and --override-arch flags.

Signed-off-by: Daniel J Walsh [email protected]

What type of PR is this?

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

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?


@openshift-ci-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment


Set the ARCH of the image to the provided value instead of using the architecture of the host.

**--arch**="ARCH"
Copy link
Contributor

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.

@@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Examples?

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

@rhatdan
Copy link
Member Author

rhatdan commented Jan 4, 2021

@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.

@rhatdan
Copy link
Member Author

rhatdan commented Jan 4, 2021

This PR allows the specification of the variant, which was one of the requested changes in that issue, I believe.

@mtrmac
Copy link
Contributor

mtrmac commented Jan 4, 2021

@mtrmac I setup aliases for --override-arch -> --arch and --override-os -> --os

Ah, my mistake. Thanks.


This PR allows the specification of the variant, which was one of the requested changes in that issue, I believe.

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 runtime.GO* should make that workaround unnecessary for common uses (OTOH I haven’t checked whether it would break anything else).

@rhatdan
Copy link
Member Author

rhatdan commented Jan 4, 2021

@mtrmac Added a second patch to stop defaulting the OS and Arch if the user did not specify it. Is this what you meant?

@TomSweeneyRedHat
Copy link
Member

@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 {
Copy link
Contributor

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 (in cmd/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.

Copy link
Member Author

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.

Copy link
Contributor

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]>
@rhatdan
Copy link
Member Author

rhatdan commented Jan 6, 2021

@mtrmac @TomSweeneyRedHat Tests are passing and I think I addressed @mtrmac concerns.
@containers/podman-maintainers PTAL

We need to get this merged so I can continue on the manifests PR.

@TomSweeneyRedHat
Copy link
Member

LGTM

@rhatdan
Copy link
Member Author

rhatdan commented Jan 6, 2021

@containers/podman-maintainers PTAL

@rhatdan
Copy link
Member Author

rhatdan commented Jan 6, 2021

@vrothberg PTAL

@ashley-cui
Copy link
Member

LGTM

@rhatdan rhatdan added todo-backport-to-1.19 We should do or consider a backport to 1.19. Remove when we either decide not to, or open a PR. lgtm labels Jan 6, 2021
@openshift-merge-robot openshift-merge-robot merged commit 02b914b into containers:master Jan 6, 2021
@nalind nalind removed the todo-backport-to-1.19 We should do or consider a backport to 1.19. Remove when we either decide not to, or open a PR. label Jan 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants