-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
add missing fallback from new frontend to daemon without sourceresolver #4647
Conversation
@@ -484,7 +484,31 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res * | |||
|
|||
func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.SourceOp, opt sourceresolver.Opt) (*sourceresolver.MetaResponse, error) { | |||
if c.caps.Supports(pb.CapSourceMetaResolver) != nil { | |||
return nil, errors.Errorf("fallback not implemented") | |||
var ref string | |||
if strings.HasPrefix(op.Identifier, "docker-image://") { |
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.
strings.CutPrefix
can replace HasPrefix
and TrimPrefix
.
if strings.HasPrefix(retRef, "docker-image://") { | ||
op.Identifier = "docker-image://" + retRef | ||
} else if strings.HasPrefix(retRef, "oci-layout://") { | ||
op.Identifier = "oci-layout://" + retRef |
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.
If HasPrefix
, prepend it again? I assume the line above should be op.Identifier
.
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 think this is still wrong. ref
has had the prefix stripped already, so the condition never triggers.
This should be:
if strings.HasPrefix(op.Identifier, "docker-image://") {
op.Identifier = "docker-image://" + retRef
}
That was we actually are checking the prefix, and making sure the output has the same prefix.
f18756f
to
4fe9630
Compare
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
4fe9630
to
0184fde
Compare
Self-merge to unblock CI |
This fallback case was accidentally left out of https://github.com/moby/buildkit/pull/4563/files
It can appear for example if new dockerfile frontend resolves SBOM generator image.