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 ARM64 to the CLI builds #453

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

marckhouzam
Copy link
Contributor

What this PR does / why we need it

This PR adds ARM64 as a target for Linux and Darwin for the actual CLI binary.
Related to #367.

An ARM64 CLI currently can only install ARM64 plugins, of which none are published. For this reason, amongst others,
the ARM64 build of the CLI would remain experimental for the moment. It is however valuable to have it available to allow testing ARM64 plugins locally as will be needed with #367.

Which issue(s) this PR fixes

Part of #357

Describe testing done for PR

$ make cross-build
build linux-amd64 CLI with version: v1.0.0-dev
build windows-amd64 CLI with version: v1.0.0-dev
build darwin-amd64 CLI with version: v1.0.0-dev
build linux-arm64 CLI with version: v1.0.0-dev
build darwin-arm64 CLI with version: v1.0.0-dev
cd cmd/plugin/builder && go build -o /Users/kmarc/git/tanzu-cli/bin/builder .
/Users/kmarc/git/tanzu-cli/bin/builder plugin build \
		--path ./cmd/plugin \
		--binary-artifacts /Users/kmarc/git/tanzu-cli/artifacts/plugins \
		--version v1.0.0-dev \
		--ldflags "-X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2023-08-02' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=b6a743c60' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev'" \
		--goflags "" \
		--os-arch linux_amd64 \
		--match "builder" \
		--plugin-scope-association-file ./cmd/plugin/plugin-scope-association.yaml
2023-08-01T22:35:34-04:00 [i] building local repository at /Users/kmarc/git/tanzu-cli/artifacts/plugins, v1.0.0-dev, [linux_amd64]
2023-08-01T22:35:34-04:00 [i] 🐯 - building plugin at path "cmd/plugin/builder"
2023-08-01T22:35:37-04:00 [i] 🐯 - $ /Users/kmarc/.asdf/shims/go build -o /Users/kmarc/git/tanzu-cli/artifacts/plugins/linux/amd64/global/builder/v1.0.0-dev/tanzu-builder-linux_amd64 -ldflags -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2023-08-02' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=b6a743c60' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev' -tags  ./cmd/plugin/builder
2023-08-01T22:35:39-04:00 [i] ========
2023-08-01T22:35:39-04:00 [i] saving plugin group manifest...
2023-08-01T22:35:39-04:00 [ok] successfully built local repository
/Users/kmarc/git/tanzu-cli/bin/builder plugin build \
		--path ./cmd/plugin \
		--binary-artifacts /Users/kmarc/git/tanzu-cli/artifacts/plugins \
		--version v1.0.0-dev \
		--ldflags "-X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2023-08-02' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=b6a743c60' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev'" \
		--goflags "" \
		--os-arch windows_amd64 \
		--match "builder" \
		--plugin-scope-association-file ./cmd/plugin/plugin-scope-association.yaml
2023-08-01T22:35:39-04:00 [i] building local repository at /Users/kmarc/git/tanzu-cli/artifacts/plugins, v1.0.0-dev, [windows_amd64]
2023-08-01T22:35:39-04:00 [i] 🐯 - building plugin at path "cmd/plugin/builder"
2023-08-01T22:35:41-04:00 [i] 🐯 - $ /Users/kmarc/.asdf/shims/go build -o /Users/kmarc/git/tanzu-cli/artifacts/plugins/windows/amd64/global/builder/v1.0.0-dev/tanzu-builder-windows_amd64.exe -ldflags -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2023-08-02' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=b6a743c60' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev' -tags  ./cmd/plugin/builder
2023-08-01T22:35:44-04:00 [i] ========
2023-08-01T22:35:44-04:00 [i] saving plugin group manifest...
2023-08-01T22:35:44-04:00 [ok] successfully built local repository
/Users/kmarc/git/tanzu-cli/bin/builder plugin build \
		--path ./cmd/plugin \
		--binary-artifacts /Users/kmarc/git/tanzu-cli/artifacts/plugins \
		--version v1.0.0-dev \
		--ldflags "-X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2023-08-02' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=b6a743c60' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev'" \
		--goflags "" \
		--os-arch darwin_amd64 \
		--match "builder" \
		--plugin-scope-association-file ./cmd/plugin/plugin-scope-association.yaml
2023-08-01T22:35:44-04:00 [i] building local repository at /Users/kmarc/git/tanzu-cli/artifacts/plugins, v1.0.0-dev, [darwin_amd64]
2023-08-01T22:35:44-04:00 [i] 🐶 - building plugin at path "cmd/plugin/builder"
2023-08-01T22:35:46-04:00 [i] 🐶 - $ /Users/kmarc/.asdf/shims/go build -o /Users/kmarc/git/tanzu-cli/artifacts/plugins/darwin/amd64/global/builder/v1.0.0-dev/tanzu-builder-darwin_amd64 -ldflags -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2023-08-02' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=b6a743c60' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v1.0.0-dev' -tags  ./cmd/plugin/builder
2023-08-01T22:35:49-04:00 [i] ========
2023-08-01T22:35:49-04:00 [i] saving plugin group manifest...
2023-08-01T22:35:49-04:00 [ok] successfully built local repository
cd /Users/kmarc/git/tanzu-cli/artifacts/plugins && tar -czvf ../plugin_bundle.tar.gz .
a .
a ./plugin_group_manifest.yaml
a ./plugin_manifest.yaml
a ./linux
a ./darwin
a ./windows
a ./windows/amd64
a ./windows/amd64/plugin_manifest.yaml
a ./windows/amd64/global
a ./windows/amd64/global/builder
a ./windows/amd64/global/builder/v1.0.0-dev
a ./windows/amd64/global/builder/v1.0.0-dev/tanzu-builder-windows_amd64.exe
a ./darwin/amd64
a ./darwin/amd64/plugin_manifest.yaml
a ./darwin/amd64/global
a ./darwin/amd64/global/builder
a ./darwin/amd64/global/builder/v1.0.0-dev
a ./darwin/amd64/global/builder/v1.0.0-dev/tanzu-builder-darwin_amd64
a ./linux/amd64
a ./linux/amd64/plugin_manifest.yaml
a ./linux/amd64/global
a ./linux/amd64/global/builder
a ./linux/amd64/global/builder/v1.0.0-dev
a ./linux/amd64/global/builder/v1.0.0-dev/tanzu-builder-linux_amd64

$ file artifacts/darwin/arm64/cli/core/v1.0.0-dev/tanzu-cli-darwin_arm64
artifacts/darwin/arm64/cli/core/v1.0.0-dev/tanzu-cli-darwin_arm64: Mach-O 64-bit executable arm64

$ file artifacts/darwin/arm64/cli/core/v1.0.0-dev/tanzu-cli-darwin_arm64
artifacts/darwin/arm64/cli/core/v1.0.0-dev/tanzu-cli-darwin_arm64: Mach-O 64-bit executable arm64

# Note there is no more warning about building for darwin arm64
$ make build
build darwin-arm64 CLI with version: v1.0.0-dev
mkdir -p bin
cp /Users/kmarc/git/tanzu-cli/artifacts/darwin/arm64/cli/core/v1.0.0-dev/tanzu-cli-darwin_arm64 ./bin/tanzu

Release note

Build the Tanzu CLI for linux-arm64 and darwin-arm64.

Additional information

Special notes for your reviewer

Signed-off-by: Marc Khouzam <[email protected]>
@marckhouzam marckhouzam requested a review from a team as a code owner August 2, 2023 02:44
Copy link
Contributor

@anujc25 anujc25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@marckhouzam marckhouzam merged commit 5d8c482 into vmware-tanzu:main Aug 2, 2023
@marckhouzam marckhouzam deleted the feat/arm64CLI branch August 2, 2023 11:11
marckhouzam added a commit to marckhouzam/tanzu-cli that referenced this pull request Aug 2, 2023
marckhouzam added a commit that referenced this pull request Aug 2, 2023
@marckhouzam marckhouzam added this to the v1.0.0 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants