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

Create an ARM based build for the pulumi cli (and plugins) #4868

Closed
9 tasks done
jaxxstorm opened this issue Jun 22, 2020 · 25 comments
Closed
9 tasks done

Create an ARM based build for the pulumi cli (and plugins) #4868

jaxxstorm opened this issue Jun 22, 2020 · 25 comments
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@jaxxstorm
Copy link
Contributor

jaxxstorm commented Jun 22, 2020

The prerequisite work is to get our projects to go1.16 so that macOS arm builds are supported

The work required here is as follows:

  • Update tf providers with arm builds
  • Update azure-native with arm build
  • Update pulumi-kubernetes with arm build
  • Update pulumi/pulumi with arm build
  • Update pulumi/awsx with arm build
  • Update pulumi/eks with arm build
  • Update plugin acquisition to detect arm in the downloads
  • Update get.pulumi.com to allow arm downloads of the CLI
  • Add some nightly tests to ensure that we can install and use the arm builds
@jaxxstorm jaxxstorm self-assigned this Jun 22, 2020
@justinvp
Copy link
Member

@lukehoban
Copy link
Member

Just a note - we will want ARM builds across all supported OS’s. Linux builds will also be valuable to support using Pulumi on cloud-based ARM servers such as AWS Graviton.

@lukehoban
Copy link
Member

Also - this will require not just CLI, but also all plugins (both resource provider plugins but also language host plugins).

@jaxxstorm
Copy link
Contributor Author

related: #5244

@lukehoban
Copy link
Member

Per #5466 - this should also include ARM Docker images.

@justinvp
Copy link
Member

ARM-based MacBook Pro 13", MacBook Air, and Mac mini available starting 11/17: https://www.apple.com/apple-events/november-2020/

@lukehoban lukehoban changed the title Create an ARM based build for the pulumi cli Create an ARM based build for the pulumi cli (and plugins) Nov 10, 2020
@jaxxstorm
Copy link
Contributor Author

I had a try at building the ARM binaries yesterday, the PR is here:

#5729

The binary worked without issue. I also built an AWS provider ARM binary which worked without any issues either.

I tried out a simple Pulumi program on an AWS graviton machine. It worked successfully with the Go SDK

What I ran into was:

  • the language SDKs need to have GRPC binaries available
    • Python didn't work (even though it's allegedly meant to be available, pip install failed)
    • Go did work
  • plugin acquisition doesn't recognise the machine's chipset yet, so plugin acquisition failed on Python

@lukehoban
Copy link
Member

lukehoban commented Nov 11, 2020

Great!

plugin acquisition doesn't recognise the machine's chipset yet, so plugin acquisition failed on Python

What exactly was the error? Was this due to

return nil, -1, errors.Errorf("unsupported plugin architecture: %s", runtime.GOARCH)

Python didn't work (even though it's allegedly meant to be available, pip install failed)

What exactly was the error?

@roderik
Copy link
Contributor

roderik commented Dec 28, 2020

There is a Go prerelease supporting the M1 but it is not installable via Homebrew
Python 3.9 is available in homebrew ARM so easy to use

I'm working on an M1 with the typescript SDK's (and the x86 version of pulumi via rosetta) which works fine, so if I can help test an ARM version, let me know

@kherings
Copy link

kherings commented Jan 8, 2021

Hi everyone, I ran into the problem described above by @jaxxstorm

pulumi plugin install resource aws v3.22.1
[resource plugin aws-3.22.1] installing
error: [resource plugin aws-3.22.1] downloading from : unsupported plugin architecture: arm64

is there any approach to work around this? (M1 Mac)

@stack72 stack72 assigned stack72 and unassigned jaxxstorm Jan 19, 2021
@stack72 stack72 added this to the 0.51 milestone Jan 19, 2021
@stack72
Copy link
Contributor

stack72 commented Jan 21, 2021

Unfortunately, this is blocked until Go 1.16 has been released goreleaser/goreleaser#1952

@stack72 stack72 removed this from the 0.51 milestone Jan 21, 2021
@roderik
Copy link
Contributor

roderik commented Jan 22, 2021

is there any approach to work around this? (M1 Mac)

I install 2 versions of homebrew, the ARM one (which uses /opt/homebrew) and the x86 one which uses /usr/local. See point 4 in https://medium.com/better-programming/5-things-i-have-learned-when-using-the-m1-chip-macbook-air-a77f93c50381

I do not use 2 terminals but I aliased this alias ibrew='arch -x86_64 /usr/local/bin/brew'

Install pulumi from ibrew and you get the x86 version that works perfectly over Rosetta
It also installs with arm brew, but then you get the plugin errors you mention here

@jamesla
Copy link

jamesla commented Mar 4, 2021

I managed to get the aws plugins working by compiling myself with the help of @stack72.

For anybody like me that can't wait the steps I followed were:

  1. clone pulumi-aws repository
  2. add arm64 as an architecture in .goreleaser.prerelease.yml
  3. comment out pulumi plugin install resource tls 2.0.0 and pulumi plugin install resource github 1.0.0 in Makefile (expecting this to bite me at some point - but works fine for now.
  4. make a local git commit and then tag it with a valid semver version
  5. goreleaser build -f .goreleaser.prerelease.yml
  6. copy dist/pulumi-aws_darwin_arm64/pulumi-resource-aws to somewhere on $PATH
  7. now you should be able to run pulumi up

Seems to work fine for me although my stacks aren't very complex.

@stack72
Copy link
Contributor

stack72 commented Mar 4, 2021

Quick update on this work:

  • pulumi-azure-native & pulumi-kubernetes are now on go1.16 so that paves the way for arm64 builds for those
  • pulumi/pulumi has a PR open Upgrading Go to 1.16.x #6470
  • pulumi tf-based providers also will have PRs open for go1.16 tomorrow (Friday March 4)

stack72 added a commit that referenced this issue Mar 10, 2021
Related: #4868

Also adds the arm64 build and deployment steps via goreleaser
stack72 added a commit that referenced this issue Mar 10, 2021
Related: #4868

Also adds the arm64 build and deployment steps via goreleaser
@stack72
Copy link
Contributor

stack72 commented Mar 10, 2021

Ok further update:

  • arm64 configs have been added to pulumi-azure-native, pulumi, pulumi-eks & pulumi-kubernetes
  • arm64 configs have been added to all tf based providers e.g. pulumi-aws, pulumi-gcp
  • PR open to allow pulumi plugin install to install arm64 plugins

Still remaining: add the work for arm64 downloads to get.pulumi.com

@roderik
Copy link
Contributor

roderik commented Mar 10, 2021

FYI: kubectl is not arm ready until this makes it into a release kubernetes/kubernetes#97743 (so at least the kubernetes and eks providers will be impacted)

@roderik
Copy link
Contributor

roderik commented Mar 10, 2021

Oh, and google-cloud-sdk also does not install under arm.

The current list I need to install under amd64 is

  • kubectx
  • kubernetes-cli
  • pulumi
  • google-cloud-sdk

and in case if anyone wonders how I do this

then brew install will do arm versions and ibrew install does the amd64 versions, preferring the arm versions if there are conflicts

stack72 added a commit that referenced this issue Mar 10, 2021
Related: #4868

Also adds the arm64 build and deployment steps via goreleaser
@stack72 stack72 added kind/enhancement Improvements or new features resolution/fixed This issue was fixed labels Mar 12, 2021
@stack72
Copy link
Contributor

stack72 commented Mar 12, 2021

Hi all

Pleased to say that this work will be available Wednesday 17th March as part of Pulumi v2.23.0

Paul

@stack72 stack72 closed this as completed Mar 12, 2021
@leezen leezen added this to the 0.53 milestone Mar 12, 2021
@stack72
Copy link
Contributor

stack72 commented Mar 17, 2021

Friends, I am happy to say that the latest CLI (v2.23.0) and the latest provider binaries are available with arm64 packages on macOS

Please let us know if there are any issues

Paul

@barakcoh
Copy link

barakcoh commented Mar 18, 2021

@stack72 I've successfully upgraded the CLI to 2.23.0 on a macbook m1 but I'm unable to use it because the AWS provider won't install

❯ brew upgrade pulumi
Warning: pulumi 2.23.0 already installed
❯ pulumi destroy -s unityscm/apps/dev-pr241

Previewing destroy (unityscm/dev-pr241)

View Live: https://app.pulumi.com/unityscm/apps/dev-pr241/previews/57a0d909-7272-41ea-9c32-dea336f0bf9a


warning: A new version of Pulumi is available. To upgrade from version '0.0.0' to '2.23.0', run
   $ brew upgrade pulumi
or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.
error: could not load plugin for aws provider 'urn:pulumi:dev-pr241::apps::pulumi:providers:aws::default_3_26_1': no resource plugin 'aws-v3.26.1' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource aws v3.26.1`


❯ pulumi plugin install resource aws v3.26.1
[resource plugin aws-3.26.1] installing
warning: A new version of Pulumi is available. To upgrade from version '0.0.0' to '2.23.0', run
   $ brew upgrade pulumi
or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.
error: [resource plugin aws-3.26.1] downloading from : 403 HTTP error fetching plugin from https://get.pulumi.com/releases/plugins/pulumi-resource-aws-v3.26.1-darwin-arm64.tar.gz

@stack72
Copy link
Contributor

stack72 commented Mar 18, 2021

Hey @barakcoh

So only the latest versions of the plug-in are built with arm so you'd have to upgrade you code to use Pulumi-aws v3.33.0 before there is an arm binary to use

Sorry for me not being clear on that point

Paul

@Adam-Burke
Copy link

Adam-Burke commented Mar 22, 2021

Hey @barakcoh

So only the latest versions of the plug-in are built with arm so you'd have to upgrade you code to use Pulumi-aws v3.33.0 before there is an arm binary to use

Hi @stack72,

I have the same issue as @barakcoh, after updating to the following

    "@pulumi/aws": "^3.34.1",
    "@pulumi/awsx": "^0.25.0",
    "@pulumi/pulumi": "^2.23.1"

I get the following error

error: could not load plugin for aws provider 'urn:pulumi:staging::env::pulumi:providers:aws::default_2_13_1': no resource plugin 'aws-v2.13.1' found in the workspace or on your $PATH, install the plugin using 'pulumi plugin install resource aws v2.13.1'

Then if I try to install that

error: [resource plugin aws-2.13.1] downloading from : 403 HTTP error fetching plugin from https://get.pulumi.com/releases/plugins/pulumi-resource-aws-v2.13.1-darwin-arm64.tar.gz

cli version: v2.23.1

@roderik
Copy link
Contributor

roderik commented Mar 22, 2021

I have been running it since launch on M1 without any issues.

Some things I would check (with examples from my setup)

package.json:

  "devDependencies": {
    "@types/lodash.merge": "4.6.6",
    "@types/node": "14.14.35",
    "prettier": "2.2.1",
    "typescript": "4.2.3"
  },
  "dependencies": {
    "@pulumi/aws": "3.34.1",
    "@pulumi/awsx": "0.25.0",
    "@pulumi/azure": "3.51.0",
    "@pulumi/cloudflare": "2.14.1",
    "@pulumi/eks": "0.22.0",
    "@pulumi/gcp": "4.15.0",
    "@pulumi/kubernetes": "2.8.3",
    "@pulumi/pulumi": "2.23.1",
    "lodash.merge": "4.6.2",
    "utility-types": "3.10.0"
  }

So you are getting an old version installed, while you define a new version. I would first recommend not using the ^ in your dependencies as you have more control over what version you actually get. But that is beside the point now.

Then if you use Yarn run yarn why @pulumi/aws:

yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@pulumi/aws"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@pulumi/aws@3.34.1"
info Has been hoisted to "@pulumi/aws"
info Reasons this module exists
   - Specified in "dependencies"
   - Hoisted from "@pulumi#eks#@pulumi#aws"
info Disk size without dependencies: "26.53MB"
info Disk size with unique dependencies: "139.66MB"
info Disk size with transitive dependencies: "222.11MB"
info Number of shared dependencies: 28
✨  Done in 0.29s.

I think you will either find here, 2 versions, or just the old version. It will tell you the reason it selected a version.

If you use npm i do not know an equivalent command, but you can open the package-lock.json and find all references to pulumu/aws

    "node_modules/@pulumi/aws": {
      "version": "v3.34.1",
      "hasInstallScript": true,
      "license": "Apache-2.0",
      "dependencies": {
        "@pulumi/pulumi": "^2.17.0",
        "aws-sdk": "^2.0.0",
        "builtin-modules": "3.0.0",
        "mime": "^2.0.0",
        "read-package-tree": "^5.2.1",
        "resolve": "^1.7.1"
      }
    },
    "node_modules/@pulumi/awsx": {
      "version": "v0.25.0+dirty",
      "license": "Apache-2.0",
      "dependencies": {
        "@pulumi/docker": "^1.0.0 || ^2.0.0",
        "@types/aws-lambda": "^8.10.23",
        "mime": "^2.0.0"
      },
      "peerDependencies": {
        "@pulumi/aws": "^3.25.1",
        "@pulumi/pulumi": "^1.9.1 || ^2.0.0"
      }
    },

Look for instances where something depends on pulumi/aws and check the version there. In essence that is the same info that yarn why returns. The lock files define the versions installed.

When you found one, you can probably find a node_modules folder in that package folder in the main node_modules. You then have to figure out why it depends on that old version. It might be because that one does not have a caret in its version and forces an older version.

Now in the pulumi stack (get the json by using pulumi stack export > tmp.json) you have something like

            {
                "urn": "urn:pulumi:production::bpaas-clusters::pulumi:providers:aws::default_3_33_0",
                "custom": true,
                "id": "659acefd-e182-47a9-bdd7-e26d64b87e96",
                "type": "pulumi:providers:aws",
                "inputs": {
                    "region": "eu-west-3",
                    "version": "3.33.0"
                },
                "outputs": {
                    "region": "eu-west-3",
                    "version": "3.33.0"
                }
            },

In your case default_2_13_1, that, if you have the right versions npm installed, will auto-upgrade, but is not. You could try to modify it to 3_33_0 and 3.33.0 everywhere it mentions default_2_13_1 and import it again (pulumi stack import --file tmp.json) but wait for Pulumi confirmation that this does not break everything.

Then again, if it cannot find the 3.33.0 version now, forcing it to use it will not really help ofcourse.

Another thing you could investigate is your path.

  • which pulumi -> /Users/roderik/.pulumi/bin/pulumi
  • which node -> /Users/roderik/.nvm/versions/node/v15.11.0/bin/node
  • echo $PATH -> /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/roderik/.nvm/versions/node/v15.11.0/bin:/opt/homebrew/Cellar/zplug/2.4.2/bin:/Users/roderik/bin:/opt/homebrew/bin:/usr/local/bin:/opt/homebrew/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/opt/zplug/repos/zpm-zsh/colorize/bin:/Users/roderik/.pulumi/bin

While typing this, just thought of a different thing, this is the flow to upgrade

  1. update package.json
  2. yarn/npm install
  3. run pulumi up.

From your error messages i think you might have forgotten to do 2.

@Adam-Burke
Copy link

Yeah everything seems to be fine from a dependecy standpoint. We use pnpm but there is a version of why and it shows the correct version. Similarly it's correct both in node_modules and pnpm-lock.yaml.

But yeah the pulumi export file still references the older versions. I updated them in our staging env and it seems to the newer installed version and that seems to have unblocked things. Seems a bit risky, but I'll live with that.

Thanks for your help.

@runlevel5
Copy link
Contributor

It would be uber awesome if docker images also offer amr64 variants

Ref: https://github.com/pulumi/pulumi/issues/7740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests