mirror of
https://github.com/containers/podman.git
synced 2025-06-29 23:22:40 +08:00
Merge pull request #16869 from nalind/always-allow-push-from-storage
Always allow pushing from containers-storage
This commit is contained in:
@ -304,6 +304,8 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
|
|||||||
pushOptions.Password = options.Password
|
pushOptions.Password = options.Password
|
||||||
pushOptions.ManifestMIMEType = manifestType
|
pushOptions.ManifestMIMEType = manifestType
|
||||||
pushOptions.RemoveSignatures = options.RemoveSignatures
|
pushOptions.RemoveSignatures = options.RemoveSignatures
|
||||||
|
pushOptions.PolicyAllowStorage = true
|
||||||
|
pushOptions.SignaturePolicyPath = options.SignaturePolicy
|
||||||
pushOptions.SignBy = options.SignBy
|
pushOptions.SignBy = options.SignBy
|
||||||
pushOptions.SignPassphrase = options.SignPassphrase
|
pushOptions.SignPassphrase = options.SignPassphrase
|
||||||
pushOptions.SignBySigstorePrivateKeyFile = options.SignBySigstorePrivateKeyFile
|
pushOptions.SignBySigstorePrivateKeyFile = options.SignBySigstorePrivateKeyFile
|
||||||
@ -357,6 +359,7 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
|
|||||||
}
|
}
|
||||||
return pushError
|
return pushError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, options entities.ImageTagOptions) error {
|
func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, options entities.ImageTagOptions) error {
|
||||||
// Allow tagging manifest list instead of resolving instances from manifest
|
// Allow tagging manifest list instead of resolving instances from manifest
|
||||||
lookupOptions := &libimage.LookupImageOptions{ManifestList: true}
|
lookupOptions := &libimage.LookupImageOptions{ManifestList: true}
|
||||||
|
7
test/deny.json
Normal file
7
test/deny.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"default": [
|
||||||
|
{
|
||||||
|
"type": "reject"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -188,6 +188,21 @@ var _ = Describe("Podman push", func() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman push from local storage with nothing-allowed signature policy", func() {
|
||||||
|
SkipIfRemote("Remote push does not support dir transport")
|
||||||
|
denyAllPolicy := filepath.Join(INTEGRATION_ROOT, "test/deny.json")
|
||||||
|
|
||||||
|
inspect := podmanTest.Podman([]string{"inspect", "--format={{.ID}}", ALPINE})
|
||||||
|
inspect.WaitWithDefaultTimeout()
|
||||||
|
Expect(inspect).Should(Exit(0))
|
||||||
|
imageID := inspect.OutputToString()
|
||||||
|
|
||||||
|
push := podmanTest.Podman([]string{"push", "--signature-policy", denyAllPolicy, "-q", imageID, "dir:" + filepath.Join(podmanTest.TempDir, imageID)})
|
||||||
|
push.WaitWithDefaultTimeout()
|
||||||
|
Expect(push).Should(Exit(0))
|
||||||
|
Expect(push.ErrorToString()).To(BeEmpty())
|
||||||
|
})
|
||||||
|
|
||||||
It("podman push to local registry with authorization", func() {
|
It("podman push to local registry with authorization", func() {
|
||||||
SkipIfRootless("volume-mounting a certs.d file N/A over remote")
|
SkipIfRootless("volume-mounting a certs.d file N/A over remote")
|
||||||
if podmanTest.Host.Arch == "ppc64le" {
|
if podmanTest.Host.Arch == "ppc64le" {
|
||||||
|
Reference in New Issue
Block a user