mirror of
https://github.com/containers/skopeo.git
synced 2025-04-28 11:14:08 +00:00
initial commit
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
commit
4c5fa92f6e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
skopeo
|
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export GOPATH:=$(CURDIR)/Godeps/_workspace:$(GOPATH)
|
||||||
|
|
||||||
|
BINDIR=${DESTDIR}/usr/local/bin/
|
||||||
|
|
||||||
|
all:
|
||||||
|
go build -o skopeo .
|
||||||
|
|
||||||
|
install:
|
||||||
|
install -d -m 0755 ${BINDIR}
|
||||||
|
install -m 755 skopeo ${BINDIR}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f skopeo
|
29
inspect.go
Normal file
29
inspect.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/reference"
|
||||||
|
engineTypes "github.com/docker/engine-api/types"
|
||||||
|
containerTypes "github.com/docker/engine-api/types/container"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ImageInspect struct {
|
||||||
|
ID string `json:"Id"`
|
||||||
|
RepoTags []string
|
||||||
|
RepoDigests []string
|
||||||
|
Parent string
|
||||||
|
Comment string
|
||||||
|
Created string
|
||||||
|
Container string
|
||||||
|
ContainerConfig *containerTypes.Config
|
||||||
|
DockerVersion string
|
||||||
|
Author string
|
||||||
|
Config *containerTypes.Config
|
||||||
|
Architecture string
|
||||||
|
Os string
|
||||||
|
Size int64
|
||||||
|
Registry string
|
||||||
|
}
|
||||||
|
|
||||||
|
func inspect(ref reference.Named, authConfig engineTypes.AuthConfig) (string, error) {
|
||||||
|
return "", nil
|
||||||
|
}
|
1
inspect_v1.go
Normal file
1
inspect_v1.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package main
|
1
inspect_v2.go
Normal file
1
inspect_v2.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package main
|
77
main.go
Normal file
77
main.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
|
"github.com/codegangsta/cli"
|
||||||
|
"github.com/docker/docker/reference"
|
||||||
|
engineTypes "github.com/docker/engine-api/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
version = "0.0.1"
|
||||||
|
usage = "inspect images"
|
||||||
|
)
|
||||||
|
|
||||||
|
var inspectCmd = func(c *cli.Context) {
|
||||||
|
ref, err := reference.ParseNamed(c.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
authConfig engineTypes.AuthConfig
|
||||||
|
username = c.GlobalString("username")
|
||||||
|
password = c.GlobalString("password")
|
||||||
|
)
|
||||||
|
if username != "" && password != "" {
|
||||||
|
authConfig = engineTypes.AuthConfig{
|
||||||
|
Username: username,
|
||||||
|
Password: password,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imgInspect, err := inspect(ref, authConfig)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
fmt.Println(imgInspect)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := cli.NewApp()
|
||||||
|
app.Name = "skopeo"
|
||||||
|
app.Version = version
|
||||||
|
app.Usage = usage
|
||||||
|
app.Flags = []cli.Flag{
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "debug",
|
||||||
|
Usage: "enable debug output for logging",
|
||||||
|
},
|
||||||
|
//cli.BoolFlag{
|
||||||
|
//Name: "tags",
|
||||||
|
//Usage: "show tags"
|
||||||
|
//},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "username",
|
||||||
|
Value: "",
|
||||||
|
Usage: "registry username",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "password",
|
||||||
|
Value: "",
|
||||||
|
Usage: "registry password",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
app.Before = func(c *cli.Context) error {
|
||||||
|
if c.GlobalBool("debug") {
|
||||||
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
app.Action = inspectCmd
|
||||||
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user