Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cmd/nerdctl/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func getBuildkitHost(cmd *cobra.Command) (string, error) {
return buildkitutil.GetBuildkitHost(ns)
}

func isImageSharable(buildkitHost string, namespace, uuid string) (bool, error) {
func isImageSharable(buildkitHost string, namespace, uuid, snapshotter string) (bool, error) {
labels, err := buildkitutil.GetWorkerLabels(buildkitHost)
if err != nil {
return false, err
Expand All @@ -111,7 +111,11 @@ func isImageSharable(buildkitHost string, namespace, uuid string) (bool, error)
if !ok {
return false, nil
}
return executor == "containerd" && containerdUUID == uuid && containerdNamespace == namespace, nil
workerSnapshotter, ok := labels["org.mobyproject.buildkit.worker.snapshotter"]
if !ok {
return false, nil
}
return executor == "containerd" && containerdUUID == uuid && containerdNamespace == namespace && workerSnapshotter == snapshotter, nil
}

func buildAction(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -235,7 +239,11 @@ func generateBuildctlArgs(cmd *cobra.Command, buildkitHost string, platform, arg
if err != nil {
return "", nil, false, "", nil, err
}
sharable, err := isImageSharable(buildkitHost, ns, info.UUID)
snapshotter, err := cmd.Flags().GetString("snapshotter")
if err != nil {
return "", nil, false, "", nil, err
}
sharable, err := isImageSharable(buildkitHost, ns, info.UUID, snapshotter)
if err != nil {
return "", nil, false, "", nil, err
}
Expand Down