Skip to content

Commit

Permalink
Merge pull request containerd#2813 from monirul/main
Browse files Browse the repository at this point in the history
Fix soci image push with multi-platforms flags
  • Loading branch information
AkihiroSuda authored Feb 17, 2024
2 parents f777a43 + fdf7968 commit 6dfb9f0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions pkg/snapshotterutil/sociutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ func CreateSoci(rawRef string, gOpts types.GlobalCommandOptions, allPlatform boo
sociCmd.Args = append(sociCmd.Args, "create")

if allPlatform {
sociCmd.Args = append(sociCmd.Args, "--all-platforms", strconv.FormatBool(allPlatform))
sociCmd.Args = append(sociCmd.Args, "--all-platforms")
}
if len(platforms) > 0 {
sociCmd.Args = append(sociCmd.Args, "--platform")
sociCmd.Args = append(sociCmd.Args, strings.Join(platforms, ","))
// multiple values need to be passed as separate, repeating flags in soci as it uses urfave
// https://github.com/urfave/cli/blob/main/docs/v2/examples/flags.md#multiple-values-per-single-flag
for _, p := range platforms {
sociCmd.Args = append(sociCmd.Args, "--platform", p)
}
}

if sOpts.SpanSize != -1 {
sociCmd.Args = append(sociCmd.Args, "--span-size", strconv.FormatInt(sOpts.SpanSize, 10))
}
Expand Down Expand Up @@ -107,11 +111,14 @@ func PushSoci(rawRef string, gOpts types.GlobalCommandOptions, allPlatform bool,
sociCmd.Args = append(sociCmd.Args, "push")

if allPlatform {
sociCmd.Args = append(sociCmd.Args, "--all-platforms", strconv.FormatBool(allPlatform))
sociCmd.Args = append(sociCmd.Args, "--all-platforms")
}
if len(platforms) > 0 {
sociCmd.Args = append(sociCmd.Args, "--platform")
sociCmd.Args = append(sociCmd.Args, strings.Join(platforms, ","))
// multiple values need to be passed as separate, repeating flags in soci as it uses urfave
// https://github.com/urfave/cli/blob/main/docs/v2/examples/flags.md#multiple-values-per-single-flag
for _, p := range platforms {
sociCmd.Args = append(sociCmd.Args, "--platform", p)
}
}
if gOpts.InsecureRegistry {
sociCmd.Args = append(sociCmd.Args, "--skip-verify")
Expand Down

0 comments on commit 6dfb9f0

Please sign in to comment.