Skip to content

Commit

Permalink
fix: --dest-creds cant be nil
Browse files Browse the repository at this point in the history
Signed-off-by: Horiodino <[email protected]>
  • Loading branch information
Horiodino committed Aug 5, 2024
1 parent 601cd7e commit 3406aa5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/oci/skopeo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ func LoadPodman(dir, imageName string) error {
// Push image to registry
func Push(dir, imageName string, destcreds string, digestPath string) error {
var cmd *exec.Cmd
if digestPath != "" {
if digestPath != "" && destcreds != "" {
cmd = exec.Command("nix", "run", "nixpkgs#skopeo", "--", "copy", "--insecure-policy", "dir:"+dir, "docker://"+imageName+"@@unknown-digest@@", "--digestfile="+digestPath, "--dest-creds", destcreds)

} else {
} else if digestPath != "" && destcreds == "" {
cmd = exec.Command("nix", "run", "nixpkgs#skopeo", "--", "copy", "--insecure-policy", "dir:"+dir, "docker://"+imageName+"@@unknown-digest@@", "--digestfile="+digestPath)
} else if destcreds != "" && digestPath == "" {
cmd = exec.Command("nix", "run", "nixpkgs#skopeo", "--", "copy", "--insecure-policy", "dir:"+dir, "docker://"+imageName, "--dest-creds", destcreds)
} else {
cmd = exec.Command("nix", "run", "nixpkgs#skopeo", "--", "copy", "--insecure-policy", "dir:"+dir, "docker://"+imageName)
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down

0 comments on commit 3406aa5

Please sign in to comment.