mirror of
https://github.com/containers/skopeo.git
synced 2025-07-31 06:31:06 +00:00
commit
d7ae061a83
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
!cmd/skopeo/
|
||||
/skopeo
|
||||
/skopeo.1
|
||||
/layers-*
|
||||
|
3
Makefile
3
Makefile
@ -22,12 +22,11 @@ endif
|
||||
DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
|
||||
|
||||
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true)
|
||||
LDFLAGS := "-X github.com/projectatomic/skopeo.GitCommit=${GIT_COMMIT} ${LDFLAGS}"
|
||||
|
||||
all: man binary
|
||||
|
||||
binary:
|
||||
go build -ldflags ${LDFLAGS} -o ${DEST}skopeo ./cmd/skopeo
|
||||
go build -ldflags "-X main.gitCommit=${GIT_COMMIT}" -o ${DEST}skopeo .
|
||||
|
||||
build-container:
|
||||
docker build ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" .
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/projectatomic/skopeo"
|
||||
)
|
||||
|
||||
var inspectCmd = cli.Command{
|
||||
@ -19,7 +18,7 @@ var inspectCmd = cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) {
|
||||
img, err := skopeo.ParseImage(c)
|
||||
img, err := parseImage(c)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/projectatomic/skopeo"
|
||||
)
|
||||
|
||||
// TODO(runcom): document args and usage
|
||||
@ -11,7 +10,7 @@ var layersCmd = cli.Command{
|
||||
Name: "layers",
|
||||
Usage: "get images layers",
|
||||
Action: func(c *cli.Context) {
|
||||
img, err := skopeo.ParseImage(c)
|
||||
img, err := parseImage(c)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
@ -6,18 +6,26 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/projectatomic/skopeo"
|
||||
"github.com/projectatomic/skopeo/version"
|
||||
)
|
||||
|
||||
// gitCommit will be the hash that the binary was built from
|
||||
// and will be populated by the Makefile
|
||||
var gitCommit = ""
|
||||
|
||||
const (
|
||||
usage = `interact with registries`
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "skopeo"
|
||||
if skopeo.GitCommit != "" {
|
||||
app.Version = fmt.Sprintf("%s commit: %s", skopeo.Version, skopeo.GitCommit)
|
||||
if gitCommit != "" {
|
||||
app.Version = fmt.Sprintf("%s commit: %s", version.Version, gitCommit)
|
||||
} else {
|
||||
app.Version = skopeo.Version
|
||||
app.Version = version.Version
|
||||
}
|
||||
app.Usage = "interact with registries"
|
||||
app.Usage = usage
|
||||
// TODO(runcom)
|
||||
//app.EnableBashCompletion = true
|
||||
app.Flags = []cli.Flag{
|
@ -8,12 +8,12 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/projectatomic/skopeo"
|
||||
"github.com/projectatomic/skopeo/version"
|
||||
)
|
||||
|
||||
const (
|
||||
signatureType = "atomic container signature"
|
||||
signatureCreatorID = "atomic " + skopeo.Version
|
||||
signatureCreatorID = "atomic " + version.Version
|
||||
)
|
||||
|
||||
// InvalidSignatureError is returned when parsing an invalid signature.
|
||||
|
4
utils.go
4
utils.go
@ -1,4 +1,4 @@
|
||||
package skopeo
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// ParseImage converts image URL-like string to an initialized handler for that image.
|
||||
func ParseImage(c *cli.Context) (types.Image, error) {
|
||||
func parseImage(c *cli.Context) (types.Image, error) {
|
||||
var (
|
||||
imgName = c.Args().First()
|
||||
certPath = c.GlobalString("cert-path")
|
||||
|
@ -1,7 +0,0 @@
|
||||
package skopeo
|
||||
|
||||
// Version is a version of thils build.
|
||||
const Version = "0.1.12-dev"
|
||||
|
||||
// GitCommit is a git commit hash of this build. It is ordinarily overriden by LDFLAGS in Makefile.
|
||||
var GitCommit = ""
|
4
version/version.go
Normal file
4
version/version.go
Normal file
@ -0,0 +1,4 @@
|
||||
package version
|
||||
|
||||
// Version is the version of the build.
|
||||
const Version = "0.1.12-dev"
|
Loading…
Reference in New Issue
Block a user