зеркало из https://github.com/docker/hub-tool.git
Add windows-arm64 cross build
Bump all dependencies Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
Родитель
44062da63a
Коммит
eae516cca7
|
@ -16,9 +16,9 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
ARG GO_VERSION=1.16.3-alpine
|
||||
ARG GO_VERSION=1.22.0-alpine3.19
|
||||
ARG CLI_VERSION=20.10.2
|
||||
ARG ALPINE_VERSION=3.12.2
|
||||
ARG ALPINE_VERSION=3.19.0
|
||||
ARG GOLANGCI_LINT_VERSION=v1.33.0-alpine
|
||||
|
||||
####
|
||||
|
|
2
Makefile
2
Makefile
|
@ -65,6 +65,8 @@ package-cross: cross ## Package the cross compiled binaries in tarballs for *nix
|
|||
--target package | gzip -9 > dist/$(BINARY_NAME)-$(subst /,-,$(plat)).tar.gz ;)
|
||||
cp bin/$(BINARY_NAME)_windows_amd64.exe $(TMPDIR_WIN_PKG)/$(BINARY_NAME).exe
|
||||
rm -f dist/$(BINARY_NAME)-windows-amd64.zip && zip dist/$(BINARY_NAME)-windows-amd64.zip -j packaging/LICENSE $(TMPDIR_WIN_PKG)/$(BINARY_NAME).exe
|
||||
cp bin/$(BINARY_NAME)_windows_arm64.exe $(TMPDIR_WIN_PKG)/$(BINARY_NAME).exe
|
||||
rm -f dist/$(BINARY_NAME)-windows-arm64.zip && zip dist/$(BINARY_NAME)-windows-arm64.zip -j packaging/LICENSE $(TMPDIR_WIN_PKG)/$(BINARY_NAME).exe
|
||||
rm -r $(TMPDIR_WIN_PKG)
|
||||
|
||||
.PHONY: install
|
||||
|
|
|
@ -63,6 +63,7 @@ cross:
|
|||
GOOS=darwin GOARCH=amd64 $(STATIC_FLAGS) $(GO_BUILD) -o bin/$(BINARY_NAME)_darwin_amd64 .
|
||||
GOOS=darwin GOARCH=arm64 $(STATIC_FLAGS) $(GO_BUILD) -o bin/$(BINARY_NAME)_darwin_arm64 .
|
||||
GOOS=windows GOARCH=amd64 $(STATIC_FLAGS) $(GO_BUILD) -o bin/$(BINARY_NAME)_windows_amd64.exe .
|
||||
GOOS=windows GOARCH=arm64 $(STATIC_FLAGS) $(GO_BUILD) -o bin/$(BINARY_NAME)_windows_arm64.exe .
|
||||
|
||||
# Note we're building statically for now to simplify releases. We can
|
||||
# investigate dynamic builds later.
|
||||
|
|
111
go.mod
111
go.mod
|
@ -1,37 +1,98 @@
|
|||
module github.com/docker/hub-tool
|
||||
|
||||
go 1.15
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/bitly/go-hostpool v0.1.0 // indirect
|
||||
github.com/cli/cli v1.14.0
|
||||
github.com/containerd/containerd v1.7.13
|
||||
github.com/docker/cli v25.0.3+incompatible
|
||||
github.com/docker/compose-cli v1.0.35
|
||||
github.com/docker/distribution v2.8.3+incompatible
|
||||
github.com/docker/docker v25.0.3+incompatible
|
||||
github.com/docker/go-units v0.5.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/mattn/go-isatty v0.0.14
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
|
||||
github.com/moby/term v0.5.0
|
||||
github.com/opencontainers/image-spec v1.1.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
golang.org/x/sync v0.6.0
|
||||
gopkg.in/square/go-jose.v2 v2.6.0
|
||||
gotest.tools/v3 v3.5.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/Microsoft/hcsshim v0.11.4 // indirect
|
||||
github.com/Shopify/logrus-bugsnag v0.0.0-20230117174420-439a4b8ba167 // indirect
|
||||
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/briandowns/spinner v1.11.1 // indirect
|
||||
github.com/bugsnag/bugsnag-go v1.5.3 // indirect
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/cli/cli v1.1.0
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cli/safeexec v1.0.0 // indirect
|
||||
github.com/cloudflare/cfssl v1.4.1 // indirect
|
||||
github.com/containerd/containerd v1.4.3
|
||||
github.com/docker/cli v20.10.3+incompatible
|
||||
github.com/docker/compose-cli v1.0.5-0.20201215113846-10a19b115968
|
||||
github.com/docker/distribution v2.7.1+incompatible
|
||||
github.com/docker/docker v20.10.3+incompatible
|
||||
github.com/docker/docker-credential-helpers v0.6.4-0.20210125172408-38bea2ce277a // indirect
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/containerd/log v0.1.0 // indirect
|
||||
github.com/distribution/reference v0.5.0 // indirect
|
||||
github.com/docker/compose/v2 v2.2.0 // indirect
|
||||
github.com/docker/docker-credential-helpers v0.7.0 // indirect
|
||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-metrics v0.0.1 // indirect
|
||||
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
|
||||
github.com/fatih/color v1.9.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/fvbommel/sortorder v1.0.2 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||
github.com/gofrs/uuid v3.3.0+incompatible // indirect
|
||||
github.com/google/uuid v1.1.2
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jinzhu/gorm v1.9.16 // indirect
|
||||
github.com/lib/pq v1.8.0 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.3 // indirect
|
||||
github.com/miekg/pkcs11 v1.0.3 // indirect
|
||||
github.com/moby/sys/mount v0.2.0 // indirect
|
||||
github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf
|
||||
github.com/opencontainers/image-spec v1.0.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.7.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.5.1
|
||||
gotest.tools/v3 v3.0.3
|
||||
github.com/klauspost/compress v1.16.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.11 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.10 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||
github.com/moby/locker v1.0.1 // indirect
|
||||
github.com/moby/sys/sequential v0.5.0 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/muesli/termenv v0.8.1 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/theupdateframework/notary v0.6.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
|
||||
go.opentelemetry.io/otel v1.19.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.19.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.19.0 // indirect
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
golang.org/x/mod v0.11.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
golang.org/x/term v0.13.0 // indirect
|
||||
golang.org/x/tools v0.10.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
|
||||
google.golang.org/grpc v1.58.3 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/dancannon/gorethink.v3 v3.0.5 // indirect
|
||||
gopkg.in/fatih/pool.v2 v2.0.0 // indirect
|
||||
gopkg.in/gorethink/gorethink.v3 v3.0.5 // indirect
|
||||
)
|
||||
|
|
1387
go.sum
1387
go.sum
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -18,25 +18,70 @@ package ansi
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/cli/cli/utils"
|
||||
"github.com/cli/cli/pkg/iostreams"
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/mgutz/ansi"
|
||||
)
|
||||
|
||||
var (
|
||||
// Outputs ANSI color if stdout is a tty
|
||||
Red = makeColorFunc("red")
|
||||
Yellow = makeColorFunc("yellow")
|
||||
Blue = makeColorFunc("blue")
|
||||
Green = makeColorFunc("green")
|
||||
)
|
||||
|
||||
func makeColorFunc(color string) func(string) string {
|
||||
cf := ansi.ColorFunc(color)
|
||||
return func(arg string) string {
|
||||
if isColorEnabled() {
|
||||
if color == "black+h" && iostreams.Is256ColorSupported() {
|
||||
return fmt.Sprintf("\x1b[%d;5;%dm%s\x1b[m", 38, 242, arg)
|
||||
}
|
||||
return cf(arg)
|
||||
}
|
||||
return arg
|
||||
}
|
||||
}
|
||||
|
||||
func isColorEnabled() bool {
|
||||
if iostreams.EnvColorForced() {
|
||||
return true
|
||||
}
|
||||
|
||||
if iostreams.EnvColorDisabled() {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO ignores cmd.OutOrStdout
|
||||
return IsTerminal(os.Stdout)
|
||||
}
|
||||
|
||||
var IsTerminal = func(f *os.File) bool {
|
||||
return isatty.IsTerminal(f.Fd()) || IsCygwinTerminal(f)
|
||||
}
|
||||
|
||||
func IsCygwinTerminal(f *os.File) bool {
|
||||
return isatty.IsCygwinTerminal(f.Fd())
|
||||
}
|
||||
|
||||
var (
|
||||
// Title color should be used for any important title
|
||||
Title = utils.Green
|
||||
Title = Green
|
||||
// Header color should be used for all the listing column headers
|
||||
Header = utils.Blue
|
||||
Header = Blue
|
||||
// Key color should be used for all key title content
|
||||
Key = utils.Blue
|
||||
Key = Blue
|
||||
// Info color should be used when we prompt an info
|
||||
Info = utils.Blue
|
||||
Info = Blue
|
||||
// Warn color should be used when we warn the user
|
||||
Warn = utils.Yellow
|
||||
Warn = Yellow
|
||||
// Error color should be used when something bad happened
|
||||
Error = utils.Red
|
||||
Error = Red
|
||||
// Emphasise color should be used with important content
|
||||
Emphasise = utils.Green
|
||||
Emphasise = Green
|
||||
// NoColor doesn't add any colors to the output
|
||||
NoColor = noop
|
||||
)
|
||||
|
|
|
@ -17,15 +17,16 @@
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/compose-cli/metrics"
|
||||
"github.com/docker/compose-cli/cli/metrics"
|
||||
)
|
||||
|
||||
//Send emit a metric message to the local Desktop metric listener
|
||||
// Send emit a metric message to the local Desktop metric listener
|
||||
func Send(parent, command string) {
|
||||
client := metrics.NewClient()
|
||||
client.Send(metrics.Command{
|
||||
client := metrics.NewClient(metrics.NewHTTPReporter(http.DefaultClient))
|
||||
client.SendUsage(metrics.CommandUsage{
|
||||
Command: strings.Join([]string{parent, command}, " "),
|
||||
Context: "hub",
|
||||
Source: "hub-cli",
|
||||
|
|
|
@ -26,7 +26,8 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/cli/cli/config/types"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/docker/hub-tool/internal"
|
||||
|
@ -43,9 +44,9 @@ const (
|
|||
itemsPerPage = 100
|
||||
)
|
||||
|
||||
//Client sends authenticated calls to the Hub API
|
||||
// Client sends authenticated calls to the Hub API
|
||||
type Client struct {
|
||||
AuthConfig types.AuthConfig
|
||||
AuthConfig registry.AuthConfig
|
||||
Ctx context.Context
|
||||
|
||||
client *http.Client
|
||||
|
@ -75,13 +76,13 @@ type tokenResponse struct {
|
|||
RefreshToken string `json:"refresh_token"`
|
||||
}
|
||||
|
||||
//ClientOp represents an option given to NewClient constructor to customize client behavior.
|
||||
// ClientOp represents an option given to NewClient constructor to customize client behavior.
|
||||
type ClientOp func(*Client) error
|
||||
|
||||
//RequestOp represents an option to customize the request sent to the Hub API
|
||||
// RequestOp represents an option to customize the request sent to the Hub API
|
||||
type RequestOp func(r *http.Request) error
|
||||
|
||||
//NewClient logs the user to the hub and returns a client which can send authenticated requests
|
||||
// NewClient logs the user to the hub and returns a client which can send authenticated requests
|
||||
// to the Hub API
|
||||
func NewClient(ops ...ClientOp) (*Client, error) {
|
||||
hubInstance := getInstance()
|
||||
|
@ -99,7 +100,7 @@ func NewClient(ops ...ClientOp) (*Client, error) {
|
|||
return client, nil
|
||||
}
|
||||
|
||||
//Update changes client behavior using ClientOp
|
||||
// Update changes client behavior using ClientOp
|
||||
func (c *Client) Update(ops ...ClientOp) error {
|
||||
for _, op := range ops {
|
||||
if err := op(c); err != nil {
|
||||
|
@ -109,7 +110,7 @@ func (c *Client) Update(ops ...ClientOp) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
//WithAllElements makes the client fetch all the elements it can find, enabling pagination.
|
||||
// WithAllElements makes the client fetch all the elements it can find, enabling pagination.
|
||||
func WithAllElements() ClientOp {
|
||||
return func(c *Client) error {
|
||||
c.fetchAllElements = true
|
||||
|
@ -117,7 +118,7 @@ func WithAllElements() ClientOp {
|
|||
}
|
||||
}
|
||||
|
||||
//WithContext set the client context
|
||||
// WithContext set the client context
|
||||
func WithContext(ctx context.Context) ClientOp {
|
||||
return func(c *Client) error {
|
||||
c.Ctx = ctx
|
||||
|
@ -125,7 +126,7 @@ func WithContext(ctx context.Context) ClientOp {
|
|||
}
|
||||
}
|
||||
|
||||
//WithInStream sets the input stream
|
||||
// WithInStream sets the input stream
|
||||
func WithInStream(in io.Reader) ClientOp {
|
||||
return func(c *Client) error {
|
||||
c.in = in
|
||||
|
@ -133,7 +134,7 @@ func WithInStream(in io.Reader) ClientOp {
|
|||
}
|
||||
}
|
||||
|
||||
//WithOutStream sets the output stream
|
||||
// WithOutStream sets the output stream
|
||||
func WithOutStream(out io.Writer) ClientOp {
|
||||
return func(c *Client) error {
|
||||
c.out = out
|
||||
|
@ -189,7 +190,7 @@ func withHubToken(token string) RequestOp {
|
|||
}
|
||||
}
|
||||
|
||||
//WithSortingOrder adds a sorting order query parameter to the request
|
||||
// WithSortingOrder adds a sorting order query parameter to the request
|
||||
func WithSortingOrder(order string) RequestOp {
|
||||
return func(req *http.Request) error {
|
||||
values, err := url.ParseQuery(req.URL.RawQuery)
|
||||
|
|
2
vars.mk
2
vars.mk
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
# Pinned Versions
|
||||
GO_VERSION=1.16.3-alpine
|
||||
GO_VERSION=1.22.0-alpine3.19
|
||||
CLI_VERSION=20.10.2
|
||||
ALPINE_VERSION=3.12.2
|
||||
GOLANGCI_LINT_VERSION=v1.33.0-alpine
|
||||
|
|
Загрузка…
Ссылка в новой задаче