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

build: add support to build linux/mac arm64 #1658

Closed
wants to merge 1 commit into from

Conversation

cpanato
Copy link

@cpanato cpanato commented Jul 3, 2021

What does this change

This PR adds build support to build the binaries for Linux/ARM64 and Mac/ARM64

Did not touch on the azure-pipelines.install.yml because I don't know if there is a pool for ARM VMs running.
Please let me know your thoughts on this and if this is not aligned with the roadmap feel free to close.

Also if someone is running Linux and/or Mac on ARM64 and what to give a try will be cool

What issue does it fix

Closes #1497

If there is not an existing issue, please make sure we have context on why this change is needed. See our Contributing Guide for examples of when an existing issue isn't necessary.

Notes for the reviewer

Put any questions or notes for the reviewer here.

Checklist

  • Unit Tests
  • Documentation
  • Schema (porter.yaml)

If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Re: arm64 Azure Pipelines agent -- it doesn't appear there are official agents available yet, so I believe a self-hosted solution would be needed (looking at https://docs.microsoft.com/en-us/azure/devops/release-notes/2020/sprint-171-update#additional-agent-platform-arm64). I know @carolynvs has previously set up a self-hosted Windows agent, so she may have a good idea around level of effort for an arm64 agent.

scripts/prep-install-scripts.sh Outdated Show resolved Hide resolved
scripts/prep-install-scripts.sh Outdated Show resolved Hide resolved
@cpanato
Copy link
Author

cpanato commented Jul 9, 2021

@vdice thanks for your review!

Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

Let's please hold off on merging until we can further think through how to treat the runtime binary.


curl -fsSLo $PORTER_HOME/porter $PORTER_MIRROR/$PORTER_PERMALINK/porter-linux-arm64
chmod +x $PORTER_HOME/porter
cp $PORTER_HOME/porter $PORTER_HOME/runtimes/porter-runtime
Copy link
Member

Choose a reason for hiding this comment

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

Have you tested out using porter-linux-arm64 installed to ~/.porter/runtimes/porter-runtime? Like built a bundle and run it?

I'm not sure that will work without further changes because we build bundles with a linux amd64 invocation image.

Copy link
Author

Choose a reason for hiding this comment

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

sorry for the delay to reply. No, but I will test, just need to setup a linux-arm64 machine, thanks for the review and feedback!

Copy link
Member

Choose a reason for hiding this comment

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

Just checking if you tried this out yet and how it went?

Copy link
Author

Choose a reason for hiding this comment

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

@carolynvs sorry :( i was busy with company work and did not have time, I will take some days off and when I comeback i will get this back on track. I will be out starting today till next Tuesday and on Wednesday I will run all the tests on this.

Copy link
Member

@carolynvs carolynvs Jul 27, 2021

Choose a reason for hiding this comment

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

No need to apologize! I just ping issues after it's been a while to see how things are going and make sure that people aren't stuck. Take your time and I appreciate you looking into this. 👍

Copy link
Author

@cpanato cpanato Aug 20, 2021

Choose a reason for hiding this comment

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

published the exec binary but looks like it tried to get the linux/amd64

ubuntu@ip-172-31-10-226:~/porter/porter$ porter mixin install exec --url https://github.com/cpanato/testing-ci-providers/releases/download/  --version v0.0.51
Error: bad status returned when downloading https://github.com/cpanato/testing-ci-providers/releases/download/v0.0.51/exec-linux-amd64 (404) 404 Not Found

which I did not publish to check if will download the right one

but my question is (I'm a newbie here, so apolagises)
the mixin exec needs to be in the same arch as we are running? if so we might need to change the code around https://github.com/getporter/porter/blob/main/pkg/pkgmgmt/client/install.go#L91

Copy link
Author

Choose a reason for hiding this comment

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

made the change and then when I run it again apparently it works

ubuntu@ip-172-31-10-226:~/porter/porter$ porter mixin install exec --url https://github.com/cpanato/testing-ci-providers/releases/download/  --version v0.0.51
installed exec mixin v0.38.3-11-g6f9ae84e (6f9ae84e)

Copy link
Author

@cpanato cpanato Aug 20, 2021

Choose a reason for hiding this comment

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

ahh! we will need to build the other mixins for the others like kubernetes/helm ... I get it now

sorry doing some rubber duck here :)

if this is something we want, I'm willing to open the changes in the other repos

Copy link
Member

Choose a reason for hiding this comment

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

Yes that would be great! 💯

Copy link
Author

Choose a reason for hiding this comment

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

ok, will work on those things 😃

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
Copy link
Member

Choose a reason for hiding this comment

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

Instead of duplicating scripts for each os+arch, since I think the only difference is the arch name, I'd like for us to look at using go env GOARCH to determine the arch value and then use that as a variable. Then we just have to maintain 3 install scripts.

goos := goos
arch := arch
// skip windows arm64
if arch == "arm64" && goos == "windows" {
Copy link
Member

Choose a reason for hiding this comment

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

In Go 1.17 we should be able to remove this skip here. Can you add a comment about that and link to the issue for Go windows/arm64 support? That way we are more likely to remember. 😀

golang/go#36439

@carolynvs carolynvs self-assigned this Jul 27, 2021
@schristoff
Copy link
Member

This is a great PR to reference in #2870 - however due to age I'm going to close it until we can readdress it in that issue.

@schristoff schristoff closed this Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

arm64 builds of Porter tools?
4 participants