Skip to content

Commit

Permalink
Handle library images
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Sep 30, 2024
1 parent 7da7969 commit f798cb2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/cmds/scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ CMD="./crane"
buf.WriteString(" ")
buf.WriteString("images/" + strings.ReplaceAll(ref.Repository, "/", "-") + "-" + ref.Tag + ".tar")
buf.WriteString(" ")
buf.WriteString("$IMAGE_REGISTRY/" + ref.Repository + ":" + ref.Tag)
if strings.HasPrefix(ref.Repository, "library/") {
buf.WriteString("$IMAGE_REGISTRY/" + ref.Repository[len("library/"):] + ":" + ref.Tag)
} else {
buf.WriteString("$IMAGE_REGISTRY/" + ref.Repository + ":" + ref.Tag)
}
buf.WriteRune('\n')
}
err = os.WriteFile(filepath.Join(outdir, "import-images.sh"), buf.Bytes(), 0o755)
Expand Down Expand Up @@ -251,7 +255,11 @@ CMD="./crane"
buf.WriteString(" ")
buf.WriteString(img)
buf.WriteString(" ")
buf.WriteString("$IMAGE_REGISTRY/" + ref.Repository + ":" + ref.Tag)
if strings.HasPrefix(ref.Repository, "library/") {
buf.WriteString("$IMAGE_REGISTRY/" + ref.Repository[len("library/"):] + ":" + ref.Tag)
} else {
buf.WriteString("$IMAGE_REGISTRY/" + ref.Repository + ":" + ref.Tag)
}
buf.WriteRune('\n')
}
err = os.WriteFile(filepath.Join(outdir, "copy-images.sh"), buf.Bytes(), 0o755)
Expand Down

0 comments on commit f798cb2

Please sign in to comment.