@@ -93,7 +93,7 @@ func getBuildkitHost(cmd *cobra.Command) (string, error) {
9393 return buildkitutil .GetBuildkitHost (ns )
9494}
9595
96- func isImageSharable (buildkitHost string , namespace , uuid string ) (bool , error ) {
96+ func isImageSharable (buildkitHost string , namespace , uuid , snapshotter string ) (bool , error ) {
9797 labels , err := buildkitutil .GetWorkerLabels (buildkitHost )
9898 if err != nil {
9999 return false , err
@@ -111,7 +111,11 @@ func isImageSharable(buildkitHost string, namespace, uuid string) (bool, error)
111111 if ! ok {
112112 return false , nil
113113 }
114- return executor == "containerd" && containerdUUID == uuid && containerdNamespace == namespace , nil
114+ workerSnapshotter , ok := labels ["org.mobyproject.buildkit.worker.snapshotter" ]
115+ if ! ok {
116+ return false , nil
117+ }
118+ return executor == "containerd" && containerdUUID == uuid && containerdNamespace == namespace && workerSnapshotter == snapshotter , nil
115119}
116120
117121func buildAction (cmd * cobra.Command , args []string ) error {
@@ -235,7 +239,11 @@ func generateBuildctlArgs(cmd *cobra.Command, buildkitHost string, platform, arg
235239 if err != nil {
236240 return "" , nil , false , "" , nil , err
237241 }
238- sharable , err := isImageSharable (buildkitHost , ns , info .UUID )
242+ snapshotter , err := cmd .Flags ().GetString ("snapshotter" )
243+ if err != nil {
244+ return "" , nil , false , "" , nil , err
245+ }
246+ sharable , err := isImageSharable (buildkitHost , ns , info .UUID , snapshotter )
239247 if err != nil {
240248 return "" , nil , false , "" , nil , err
241249 }
0 commit comments