From cdb178e954f9c6457952820508360658c57dc648 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 8 Dec 2023 17:48:42 +0100 Subject: [PATCH] cli: podman push --encryption-key use StringArray() This option accepts a file path so we should allow commas in it. Also add tests for --decryption-key Signed-off-by: Paul Holzinger --- cmd/podman/images/push.go | 2 +- test/e2e/pull_test.go | 2 +- test/e2e/run_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go index 6d22a61032..168411328f 100644 --- a/cmd/podman/images/push.go +++ b/cmd/podman/images/push.go @@ -138,7 +138,7 @@ func pushFlags(cmd *cobra.Command) { _ = cmd.RegisterFlagCompletionFunc(compLevel, completion.AutocompleteNone) encryptionKeysFlagName := "encryption-key" - flags.StringSliceVar(&pushOptions.EncryptionKeys, encryptionKeysFlagName, nil, "Key with the encryption protocol to use to encrypt the image (e.g. jwe:/path/to/key.pem)") + flags.StringArrayVar(&pushOptions.EncryptionKeys, encryptionKeysFlagName, nil, "Key with the encryption protocol to use to encrypt the image (e.g. jwe:/path/to/key.pem)") _ = cmd.RegisterFlagCompletionFunc(encryptionKeysFlagName, completion.AutocompleteDefault) encryptLayersFlagName := "encrypt-layer" diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 9a3b5f049f..465786917f 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -612,7 +612,7 @@ var _ = Describe("Podman pull", func() { decryptionTestHelper := func(imgPath string) *PodmanSessionIntegration { bitSize := 1024 - keyFileName := filepath.Join(podmanTest.TempDir, "key") + keyFileName := filepath.Join(podmanTest.TempDir, "key,withcomma") publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize) Expect(err).ToNot(HaveOccurred()) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index f07ece51cf..b42b2b661c 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -2152,7 +2152,7 @@ WORKDIR /madethis`, BB) } bitSize := 1024 - keyFileName := filepath.Join(podmanTest.TempDir, "key") + keyFileName := filepath.Join(podmanTest.TempDir, "key,withcomma") publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize) Expect(err).ToNot(HaveOccurred())