From 6c0547e7e6c90f8b08b3f866f3bb9fe8cc8f9612 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 12 Apr 2023 11:00:55 +0100 Subject: [PATCH] bake: ensure remote files behind ssh expose agent The updateContext function may make modifications to the build inputs, creating either an SSH URL, or an SSH llb.State. In these cases, we need to ensure that we appropriately expose the client's default agent. Previously, we would only expose it if the remote context was a git URL, however, we need to also ensure that if the input was used to override the context (in the case of ReadRemoteFiles), that we expose the agent here as well. Signed-off-by: Justin Chadwell --- bake/bake.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bake/bake.go b/bake/bake.go index e8073202..62ab618a 100644 --- a/bake/bake.go +++ b/bake/bake.go @@ -1105,7 +1105,7 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) { if err != nil { return nil, err } - if len(sshSpecs) == 0 && buildflags.IsGitSSH(contextPath) { + if len(sshSpecs) == 0 && (buildflags.IsGitSSH(bi.ContextPath) || (inp != nil && buildflags.IsGitSSH(inp.URL))) { sshSpecs = append(sshSpecs, &controllerapi.SSH{ID: "default"}) } sshAttachment, err := controllerapi.CreateSSH(sshSpecs)