@@ -241,11 +241,21 @@ func NewBuildOpts(ctx context.Context, basePath string, contextMap map[string][]
241241 return args , nil
242242 }
243243
244- sshExtract := func (key string ) []sshprovider.AgentConfig {
244+ sshExtract := func (key string ) ( []sshprovider.AgentConfig , error ) {
245245 values , ok := contextMap [key ]
246246 if ! ok {
247- return nil
247+ return nil , nil
248248 }
249+ // Only --ssh default is supported for now, so all other cases are rejected.
250+ if len (values ) != 1 {
251+ return nil , ErrUnsupportedSSH
252+ }
253+
254+ value := strings .TrimSpace (values [0 ])
255+ if value != "default" {
256+ return nil , ErrUnsupportedSSH
257+ }
258+
249259 agentConfigs := make ([]sshprovider.AgentConfig , 0 , len (values ))
250260 for _ , value := range values {
251261 id , path , hasPath := strings .Cut (value , "=" )
@@ -267,7 +277,7 @@ func NewBuildOpts(ctx context.Context, basePath string, contextMap map[string][]
267277 }
268278 agentConfigs = append (agentConfigs , config )
269279 }
270- return agentConfigs
280+ return agentConfigs , nil
271281 }
272282
273283 labels := mapExtract (KeyLabels )
@@ -276,7 +286,10 @@ func NewBuildOpts(ctx context.Context, basePath string, contextMap map[string][]
276286 if err != nil {
277287 return nil , err
278288 }
279- ssh := sshExtract (KeySSH )
289+ ssh , err := sshExtract (KeySSH )
290+ if err != nil {
291+ return nil , err
292+ }
280293 cacheIn := contextMap [KeyCacheIn ]
281294 cacheOut := contextMap [KeyCacheOut ]
282295 outputs := contextMap [KeyOutput ]
0 commit comments