-
Notifications
You must be signed in to change notification settings - Fork 1.4k
dockerfile: maintain osversion/variant from the base image #5714
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -801,10 +801,15 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS | |
| target.state = target.state.SetMarshalDefaults(defaults...) | ||
|
|
||
| if !platformOpt.implicitTarget { | ||
| sameOsArch := platformOpt.targetPlatform.OS == target.image.OS && platformOpt.targetPlatform.Architecture == target.image.Architecture | ||
| target.image.OS = platformOpt.targetPlatform.OS | ||
| target.image.Architecture = platformOpt.targetPlatform.Architecture | ||
| target.image.Variant = platformOpt.targetPlatform.Variant | ||
| target.image.OSVersion = platformOpt.targetPlatform.OSVersion | ||
| if platformOpt.targetPlatform.Variant != "" || !sameOsArch { | ||
| target.image.Variant = platformOpt.targetPlatform.Variant | ||
| } | ||
| if platformOpt.targetPlatform.OSVersion != "" || !sameOsArch { | ||
| target.image.OSVersion = platformOpt.targetPlatform.OSVersion | ||
| } | ||
| if platformOpt.targetPlatform.OSFeatures != nil { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't merging the OSFeatures, it's replacing them, so I don't understand where duplicates would come from? It should just be a straight-up copy of It probably should have had the same
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah, yeah. I guess I looked that it was appending to the old
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I had to open-code That's no longer the case so we could clean that up for readability now. |
||
| target.image.OSFeatures = append([]string{}, platformOpt.targetPlatform.OSFeatures...) | ||
| } | ||
|
|
||
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.
I'm not sure i understand the
sameOsArchcheck here.Also the test does not cover it.
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 meaning of this section seems to be that if explicit platform was set then it rewrites the one in the loaded base image. I guess it is mainly related to the case where single arch image is loaded with
FROMeven if it is for a wrong arch. I don't set the variant/osversion in this case to avoid cases where--platform linux/*build would get osversion(or wrong variant) from the base image.