mirror of
https://github.com/containers/skopeo.git
synced 2025-06-25 14:22:29 +00:00
move dockerutils under docker/utils
also remove fixtures pkg as it would clutter godoc (there's not need to have a .go files with fixtures) Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
df618e5f7a
commit
e775248b96
@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/projectatomic/skopeo/dockerutils"
|
||||
"github.com/projectatomic/skopeo/docker/utils"
|
||||
)
|
||||
|
||||
// inspectOutput is the output format of (skopeo inspect), primarily so that we can format it with a simple json.MarshalIndent.
|
||||
@ -50,7 +50,7 @@ var inspectCmd = cli.Command{
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
manifestDigest, err := dockerutils.ManifestDigest(rawManifest)
|
||||
manifestDigest, err := utils.ManifestDigest(rawManifest)
|
||||
if err != nil {
|
||||
logrus.Fatalf("Error computing manifest digest: %s", err.Error())
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/projectatomic/skopeo/dockerutils"
|
||||
"github.com/projectatomic/skopeo/docker/utils"
|
||||
"github.com/projectatomic/skopeo/reference"
|
||||
"github.com/projectatomic/skopeo/types"
|
||||
)
|
||||
@ -43,14 +43,14 @@ func (d *dockerImageDestination) CanonicalDockerReference() (string, error) {
|
||||
func (d *dockerImageDestination) PutManifest(manifest []byte) error {
|
||||
// FIXME: This only allows upload by digest, not creating a tag. See the
|
||||
// corresponding comment in NewOpenshiftImageDestination.
|
||||
digest, err := dockerutils.ManifestDigest(manifest)
|
||||
digest, err := utils.ManifestDigest(manifest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
url := fmt.Sprintf(manifestURL, d.ref.RemoteName(), digest)
|
||||
|
||||
headers := map[string]string{}
|
||||
mimeType := dockerutils.GuessManifestMIMEType(manifest)
|
||||
mimeType := utils.GuessManifestMIMEType(manifest)
|
||||
if mimeType != "" {
|
||||
headers["Content-Type"] = mimeType
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package fixtures
|
||||
package utils
|
||||
|
||||
const (
|
||||
// TestV2S2ManifestDigest is the Docker manifest digest of "v2s2.manifest.json"
|
@ -1,4 +1,4 @@
|
||||
package dockerutils
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
@ -1,11 +1,10 @@
|
||||
package dockerutils
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/projectatomic/skopeo/dockerutils/fixtures"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -36,8 +35,8 @@ func TestManifestDigest(t *testing.T) {
|
||||
path string
|
||||
digest string
|
||||
}{
|
||||
{"v2s2.manifest.json", fixtures.TestV2S2ManifestDigest},
|
||||
{"v2s1.manifest.json", fixtures.TestV2S1ManifestDigest},
|
||||
{"v2s2.manifest.json", TestV2S2ManifestDigest},
|
||||
{"v2s1.manifest.json", TestV2S1ManifestDigest},
|
||||
}
|
||||
for _, c := range cases {
|
||||
manifest, err := ioutil.ReadFile(filepath.Join("fixtures", c.path))
|
@ -14,7 +14,7 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/projectatomic/skopeo/docker"
|
||||
"github.com/projectatomic/skopeo/dockerutils"
|
||||
"github.com/projectatomic/skopeo/docker/utils"
|
||||
"github.com/projectatomic/skopeo/types"
|
||||
"github.com/projectatomic/skopeo/version"
|
||||
)
|
||||
@ -289,7 +289,7 @@ func (d *openshiftImageDestination) CanonicalDockerReference() (string, error) {
|
||||
|
||||
func (d *openshiftImageDestination) PutManifest(manifest []byte) error {
|
||||
// Note: This does absolutely no kind/version checking or conversions.
|
||||
manifestDigest, err := dockerutils.ManifestDigest(manifest)
|
||||
manifestDigest, err := utils.ManifestDigest(manifest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ package signature
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/projectatomic/skopeo/dockerutils"
|
||||
"github.com/projectatomic/skopeo/docker/utils"
|
||||
)
|
||||
|
||||
// SignDockerManifest returns a signature for manifest as the specified dockerReference,
|
||||
// using mech and keyIdentity.
|
||||
func SignDockerManifest(manifest []byte, dockerReference string, mech SigningMechanism, keyIdentity string) ([]byte, error) {
|
||||
manifestDigest, err := dockerutils.ManifestDigest(manifest)
|
||||
manifestDigest, err := utils.ManifestDigest(manifest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -28,7 +28,7 @@ func SignDockerManifest(manifest []byte, dockerReference string, mech SigningMec
|
||||
// using mech.
|
||||
func VerifyDockerManifestSignature(unverifiedSignature, unverifiedManifest []byte,
|
||||
expectedDockerReference string, mech SigningMechanism, expectedKeyIdentity string) (*Signature, error) {
|
||||
expectedManifestDigest, err := dockerutils.ManifestDigest(unverifiedManifest)
|
||||
expectedManifestDigest, err := utils.ManifestDigest(unverifiedManifest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user