Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add windows-arm64 cross build #220

Merged
merged 6 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ jobs:
run: make validate

- name: Run golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.31.0
./golangci-lint run
run: make lint

build-linux:
name: Build Linux
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release-weekly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ jobs:
run: make validate

- name: Run golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.31.0
./golangci-lint run
run: make lint

build:
name: Cross compile
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# 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 GOLANGCI_LINT_VERSION=v1.33.0-alpine
ARG ALPINE_VERSION=3.19.0
ARG GOLANGCI_LINT_VERSION=v1.56.2-alpine

####
# BUILDER
Expand Down Expand Up @@ -58,7 +58,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
FROM builder AS validate-headers
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go get -u github.com/kunalkushwaha/ltag && ./scripts/validate/fileheader
go install github.com/kunalkushwaha/ltag@latest && ./scripts/validate/fileheader

####
# CHECK GO MOD
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions builder.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions e2e/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/docker/cli/cli/config/configfile"
clitypes "github.com/docker/cli/cli/config/types"
"gotest.tools/v3/assert"
"gotest.tools/v3/env"
"gotest.tools/v3/fs"
"gotest.tools/v3/icmd"
)
Expand All @@ -48,10 +47,10 @@ func hubToolCmd(t *testing.T, args ...string) (icmd.Cmd, func()) {
assert.NilError(t, err)
hubTool := os.Getenv("BINARY")
configDir := fs.NewDir(t, t.Name(), fs.WithFile("config.json", string(data)))
cleanup := env.Patch(t, "PATH", os.Getenv("PATH")+getPathSeparator()+filepath.Join(pwd, "..", "bin"))
t.Setenv("PATH", os.Getenv("PATH")+getPathSeparator()+filepath.Join(pwd, "..", "bin"))
env := append(os.Environ(), "DOCKER_CONFIG="+configDir.Path())

return icmd.Cmd{Command: append([]string{hubTool}, args...), Env: env}, func() { cleanup(); configDir.Remove() }
return icmd.Cmd{Command: append([]string{hubTool}, args...), Env: env}, func() { configDir.Remove() }
}

func getPathSeparator() string {
Expand Down
111 changes: 86 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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/distribution/reference v0.5.0
github.com/docker/cli v25.0.3+incompatible
github.com/docker/compose-cli v1.0.35
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/docker/compose/v2 v2.2.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // 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
)
Loading
Loading