sonatype-nexus-community / nancy

A tool to check for vulnerabilities in your Golang dependencies, powered by Sonatype OSS Index
Apache License 2.0
562 stars 74 forks source link

brew install fails on Mac with M1 chip #229

Closed SVilgelm closed 3 years ago

SVilgelm commented 3 years ago

==> Tapping sonatype-nexus-community/nancy-tap Cloning into '/opt/homebrew/Library/Taps/sonatype-nexus-community/homebrew-nancy-tap'... Error: Invalid formula: /opt/homebrew/Library/Taps/sonatype-nexus-community/homebrew-nancy-tap/nancy.rb formulae require at least a URL Error: Cannot tap sonatype-nexus-community/nancy-tap: invalid syntax in tap! Tapping sonatype-nexus-community/nancy-tap has failed!



* **What feature or behavior is this required for?**
MacBook with M1 chip

* **How could we solve this issue? (Not knowing is okay!)**
Add `arm64` in goreleaser

* **Anything else?**

I've faced same problem in my projects, so simple adding the `arm64` in goreleaser helps at least for home-brew builds.

cc @bhamail / @DarthHater
bhamail commented 3 years ago

Thanks for filing this issue! I am still hoping to use this Issue as a way to convince my boss I need a new M1 Mac. ;)

While your suggested build change churns, in case others are hit the same issue, I found some mentions of working around the problem by prefixing the brew commands with arch -x86_64.

I will add arm64 to goreleaser. Please give it a spin once it builds, and let us know how it goes.

SVilgelm commented 3 years ago

sure, I will definitely test it as soon as it released. I see that the release job is failed.

SVilgelm commented 3 years ago

I see, you use

executors:
  go:
    docker:
      - image: circleci/golang:1.13

but to build for the M1 chip, you need to use go v1.16

bhamail commented 3 years ago

Great point! However, I'm actually seeing a failure to build one of our Docker images, so I suspect an additional issue with goreleaser and something that changed since our last release.

  $ goreleaser  --snapshot --skip-publish --rm-dist
Click to expand! ```shell $ goreleaser --snapshot --skip-publish --rm-dist • releasing... • loading config file file=.goreleaser.yml • loading environment variables • getting and validating git state • releasing v1.0.18, commit 1df387792fff33739c2c671266c23c486f394d54 • pipe skipped error=disabled during snapshot mode • parsing tag • running before hooks • running go mod download • running go mod tidy • setting defaults • snapshotting • github/gitlab/gitea releases • project name • building binaries • creating source archive • archives • linux packages • snapcraft packages • calculating checksums • signing artifacts • docker images • artifactory • blobs • homebrew tap formula • optimistically guessing `brew[0].install` to be `bin.install "nancy"` • scoop manifests • milestones • snapshotting • checking ./dist • --rm-dist is set, cleaning it up • writing effective config file • writing config=dist/config.yaml • generating changelog • pipe skipped error=not available for snapshots • building binaries • building binary=/Users/bhamail/sonatype/community/go/nancy/dist/nancy_windows_386/nancy.exe • building binary=/Users/bhamail/sonatype/community/go/nancy/dist/nancy_linux_amd64/nancy • building binary=/Users/bhamail/sonatype/community/go/nancy/dist/nancy_linux_arm64/nancy • building binary=/Users/bhamail/sonatype/community/go/nancy/dist/nancy_linux_386/nancy • building binary=/Users/bhamail/sonatype/community/go/nancy/dist/nancy_windows_amd64/nancy.exe • building binary=/Users/bhamail/sonatype/community/go/nancy/dist/nancy_darwin_amd64/nancy • archives • skip archiving binary=nancy • skip archiving binary=nancy • skip archiving binary=nancy • skip archiving binary=nancy.exe • skip archiving binary=nancy.exe • skip archiving binary=nancy • creating archive=dist/nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-amd64.tar.gz • creating archive=dist/nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-windows-amd64.zip • creating archive=dist/nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-386.tar.gz • creating archive=dist/nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-windows-386.zip • creating archive=dist/nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-darwin-amd64.tar.gz • creating archive=dist/nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-arm64.tar.gz • creating source archive • pipe skipped error=source pipe is disabled • linux packages • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_arm64.deb • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_386.rpm • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_amd64.deb • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_arm64.apk • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_arm64.rpm • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_386.deb • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_amd64.rpm • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_amd64.apk • creating file=dist/nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_386.apk • snapcraft packages • calculating checksums • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_amd64.rpm • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-darwin-amd64 • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_arm64.apk • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-amd64.tar.gz • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-386.tar.gz • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-windows-amd64.zip • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-windows-amd64.exe • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_amd64.deb • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-darwin-amd64.tar.gz • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-386 • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-amd64 • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_amd64.apk • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-arm64.tar.gz • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-windows-386.zip • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-linux-arm64 • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_386.rpm • checksumming file=nancy-v1.0.18-next-1df387792fff33739c2c671266c23c486f394d54-windows-386.exe • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_arm64.rpm • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_386.apk • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_386.deb • checksumming file=nancy_1.0.18-next-1df387792fff33739c2c671266c23c486f394d54_linux_arm64.deb • signing artifacts • docker images • building docker image buildx=false image=sonatypecommunity/nancy:latest ⨯ release failed after 9.80s error=failed to link dockerfile: link build/Dockerfile.alpine dist/goreleaserdocker586379055/Dockerfile: no such file or directory ```

I backed out the arm64 change, and still see the above problem with goreleaser. (I'm running go version go1.16.2)

fitzoh commented 3 years ago

I'm actually seeing a failure to build one of our Docker images, so I suspect an additional issue with goreleaser and something that changed since our last release.

I think that should be fixed by https://github.com/sonatype-nexus-community/nancy/pull/231

SVilgelm commented 3 years ago

Yeah, I see the build is fixed. Could you please release next version?

bhamail commented 3 years ago

Thank You @zendern for finding and fixing the build issue!

@SVilgelm The build of release v1.0.19 succeeded, and the bits should trickle out momentarily. I didn't see a specific darwin-arm64 binary generate, so maybe there is more I need to change? If things still fail for you, could you share a link to adding the arm64 in goreleaser helps at least for home-brew builds?

SVilgelm commented 3 years ago

@bhamail you still need to change the executor to use go v1.16: https://github.com/sonatype-nexus-community/nancy/blob/main/.circleci/config.yml#L17-L20 otherwise it will not build for M1 chip

bhamail commented 3 years ago

@bhamail you still need to change the executor to use go v1.16: https://github.com/sonatype-nexus-community/nancy/blob/main/.circleci/config.yml#L17-L20 otherwise it will not build for M1 chip

Doh! And you even explicitly told me that. On it.

bhamail commented 3 years ago

OK, v1.0.20 looks much better, as there is a darwin-arm64 binary. Please holler with your results.

SVilgelm commented 3 years ago

Confirm, it works:

==> Updated Formulae
Updated 18 formulae.

Using golangci/tap
Using kyoh86/tap
Tapping sonatype-nexus-community/nancy-tap
Using sv-tools/apps
Using golangci/tap/golangci-lint
Using kyoh86/tap/richgo
Installing sonatype-nexus-community/nancy-tap/nancy
Using sv-tools/apps/bumptag
Homebrew Bundle complete! 8 Brewfile dependencies now installed.

..............

Checking for updates...
Already up-to-date.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Summary                     ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━┫
┃ Audited Dependencies    ┃ 6 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━┫
┃ Vulnerable Dependencies ┃ 0 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━┛
bhamail commented 3 years ago

Thanks so much for your help with this! I still say I need some M1 silicon. ;)

SVilgelm commented 3 years ago

They are pretty good, very fast :) There is only one problem with developing in go - debugging does not work because of the issue: https://github.com/go-delve/delve/issues/2436