mirror of
https://github.com/harness/drone.git
synced 2025-05-09 03:52:00 +08:00
feat: [CDE-549]: Handle no tag (#3140)
* feat: [CDE-549]: use --src-tls-verify * feat: [CDE-549]: Handle no tag
This commit is contained in:
parent
65a9253a9b
commit
93c1462fec
@ -369,7 +369,7 @@ func CopyImage(
|
||||
|
||||
// Build skopeo command
|
||||
platform := getPlatform(runArgsMap)
|
||||
args := []string{"copy", "--debug", "--tls-verify=false"}
|
||||
args := []string{"copy", "--debug", "--src-tls-verify=false"}
|
||||
|
||||
if platform != "" {
|
||||
args = append(args, "--override-os", platform)
|
||||
@ -385,8 +385,8 @@ func CopyImage(
|
||||
|
||||
// Source and destination
|
||||
source := "docker://" + imageName
|
||||
// TODO: if imageName doesn't have tag, use latest in destination
|
||||
destination := "docker-daemon:" + imageName
|
||||
image, tag := splitImageName(imageName)
|
||||
destination := "docker-daemon:" + image + ":" + tag
|
||||
args = append(args, source, destination)
|
||||
|
||||
cmd := exec.CommandContext(ctx, "skopeo", args...)
|
||||
@ -628,3 +628,12 @@ func buildImagePullOptions(
|
||||
|
||||
return pullOpts, nil
|
||||
}
|
||||
|
||||
func splitImageName(image string) (name, tag string) {
|
||||
parts := strings.Split(image, ":")
|
||||
if len(parts) == 1 {
|
||||
// If there's no tag, default to "latest"
|
||||
return parts[0], "latest"
|
||||
}
|
||||
return parts[0], parts[1]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user