stripe-cli
stripe-cli copied to clipboard
Support Linuxbrew
Problem
I am on a Linux machine right now and I would like to install Stripe CLI through a package manager so that I don't have to deal with updates myself, however it seems that the APT package that I was using is not available anymore. I was looking to use the Homebrew for Linux package instead, however it appears that it only supports Macs. From what I saw, it looks like it shouldn't be too difficult to add support for Linux.
If it is of any use, here is the output I get right now:
~$ brew install stripe/stripe-cli/stripe
==> Tapping stripe/stripe-cli
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/stripe/homebrew-stripe-cli'...
remote: Enumerating objects: 288, done.
remote: Counting objects: 100% (120/120), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 288 (delta 39), reused 0 (delta 0), pack-reused 168
Receiving objects: 100% (288/288), 36.85 KiB | 1.15 MiB/s, done.
Resolving deltas: 100% (94/94), done.
Error: Invalid formula: /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/stripe/homebrew-stripe-cli/stripe.rb
formulae require at least a URL
Error: Cannot tap stripe/stripe-cli: invalid syntax in tap!
https://github.com/stripe/homebrew-stripe-cli/issues/2
Feature
The addition of a Linux package to the Homebrew formula would allow this package to be installed on Linuxbrew. I'm not sure how this would fit in with your current release process. I did a little bit of digging and can see that Goreleaser is being used and that it sets an install section in the formula. Not entirely sure if it would break if the Linux workflow would break this if it were set there as well.
Examples
N/a. Just being able to install on Linux through Homebrew.
Sorry about the trouble here. We lost apt and yum support after the jfrog/bintray deprecation and haven't been able to find a good alternative.
I'm not sure Linuxbrew will be easy for us to do at the moment given our current CI + goreleaser pipeline. Right now we have GitHub actions running and building the CLI on each operating system. The homebrew target only runs on Mac for the Mac builds.
From how I understand goreleaser works, the homebrew recipe is generated based on the previously defined architecture and it completely squashes the prior homebrew recipe everytime we run a new release. So if we added brew to the Linux build it would squash the Mac build.
We could combine some of the build pipelines but I'm worried about platform-specific bugs that could arise here, we've had problems with this in the past and had to add special workarounds to resolve these kinds of issues (see #439). We had to move off of all that though because they weren't keeping up with new Golang releases, which was also introducing problems.
Anyway that's a slightly long winded reply. We'll definitely keep looking into this as we'd really want to make the install process on Linux much easier.
I completely understand that viewpoint. If an effort is being put into making it easier to install on Linux, maybe Snap or Flatpak would be an option?
I'm not really familiar with either, I'll look into those!
I am running into a similar issue -- trying to install the CLI via homebrew but cannot due to "invalid syntax in tap." Why is this listed as an option in the documentation if it doesn't work?
Also having this problem. Using Linux because I'm using WSL2 on Windows as my dev machine.
Also having this problem on Linux. Currently running Ubuntu 21.04.
FWIW it’s possible to generate Linux Homebrew formulæ using GoReleaser. I was able to successfully generate a valid Linux formula by simply copy/pasting the brews: section from .goreleaser/mac.yml into .goreleaser/linux.yml:
diff --git .goreleaser/linux.yml .goreleaser/linux.yml
index f7b503e..faf99b8 100644
--- .goreleaser/linux.yml
+++ .goreleaser/linux.yml
@@ -62,3 +62,28 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=repository=https://github.com/stripe/stripe-cli"
- "--label=homepage=https://stripe.com"
+brews:
+ - tap:
+ owner: stripe
+ name: homebrew-stripe-cli
+ commit_author:
+ name: stripe-ci
+ email: [email protected]
+ homepage: https://stripe.com
+ description: Stripe CLI utility
+ install: |
+ bin.install "stripe"
+ rm Dir["#{bin}/{stripe-completion.bash,stripe-completion.zsh}"]
+ system bin/"stripe", "completion", "--shell", "bash"
+ system bin/"stripe", "completion", "--shell", "zsh"
+ bash_completion.install "stripe-completion.bash"
+ zsh_completion.install "stripe-completion.zsh"
+ (zsh_completion/"_stripe").write <<~EOS
+ #compdef stripe
+ _stripe () {
+ local e
+ e=$(dirname ${funcsourcetrace[1]%:*})/stripe-completion.zsh
+ if [[ -f $e ]]; then source $e; fi
+ }
+ EOS
+ caveats: "❤ Thanks for installing the Stripe CLI! If this is your first time using the CLI, be sure to run `stripe login` first."
Then:
# --skip-publish --skip-validate to make it work in local even if v1.7.0 is not the latest commit
goreleaser release -f .goreleaser/linux.yml --skip-publish --skip-validate --rm-dist
# fix the checksum because the generated tarball is not exactly the same as the one published by Stripe
real_checksum=$(curl -Ls https://github.com/stripe/stripe-cli/releases/download/v1.7.0/stripe_1.7.0_linux_x86_64.tar.gz | shasum -a 256 | awk '{print $1}')
sed -i'' 's/sha256 ".*"/sha256 "'$real_checksum'"/' dist/stripe.rb
brew install ./dist/stripe.rb
The code above is just a proof that adding that section in the GoReleaser file work; it shouldn’t be used as-is.
That said, the current workflow runs a goreleaser command per OS, and as such cannot generate a Homebrew formula that works with both Mac and Linux. One workaround would be to publish a Linux-only formula like stripe-linux.rb.
Edit: I wrote this formula: brew install bfontaine/utils/stripe.
Just ran into this as well. It really should be removed from the docs until this is fixed.
FWIW it’s possible to generate Linux Homebrew formulæ using GoReleaser. I was able to successfully generate a valid Linux formula by simply copy/pasting the
brews:section from.goreleaser/mac.ymlinto.goreleaser/linux.yml:diff --git .goreleaser/linux.yml .goreleaser/linux.yml index f7b503e..faf99b8 100644 --- .goreleaser/linux.yml +++ .goreleaser/linux.yml @@ -62,3 +62,28 @@ dockers: - "--label=org.opencontainers.image.version={{.Version}}" - "--label=repository=https://github.com/stripe/stripe-cli" - "--label=homepage=https://stripe.com" +brews: + - tap: + owner: stripe + name: homebrew-stripe-cli + commit_author: + name: stripe-ci + email: [email protected] + homepage: https://stripe.com + description: Stripe CLI utility + install: | + bin.install "stripe" + rm Dir["#{bin}/{stripe-completion.bash,stripe-completion.zsh}"] + system bin/"stripe", "completion", "--shell", "bash" + system bin/"stripe", "completion", "--shell", "zsh" + bash_completion.install "stripe-completion.bash" + zsh_completion.install "stripe-completion.zsh" + (zsh_completion/"_stripe").write <<~EOS + #compdef stripe + _stripe () { + local e + e=$(dirname ${funcsourcetrace[1]%:*})/stripe-completion.zsh + if [[ -f $e ]]; then source $e; fi + } + EOS + caveats: "❤ Thanks for installing the Stripe CLI! If this is your first time using the CLI, be sure to run `stripe login` first."Then:
# --skip-publish --skip-validate to make it work in local even if v1.7.0 is not the latest commit goreleaser release -f .goreleaser/linux.yml --skip-publish --skip-validate --rm-dist # fix the checksum because the generated tarball is not exactly the same as the one published by Stripe real_checksum=$(curl -Ls https://github.com/stripe/stripe-cli/releases/download/v1.7.0/stripe_1.7.0_linux_x86_64.tar.gz | shasum -a 256 | awk '{print $1}') sed -i'' 's/sha256 ".*"/sha256 "'$real_checksum'"/' dist/stripe.rb brew install ./dist/stripe.rbThe code above is just a proof that adding that section in the GoReleaser file work; it shouldn’t be used as-is.
That said, the current workflow runs a
goreleasercommand per OS, and as such cannot generate a Homebrew formula that works with both Mac and Linux. One workaround would be to publish a Linux-only formula likestripe-linux.rb.Edit: I wrote this formula:
brew install bfontaine/utils/stripe.
Have you done a PR for this? It looks simple enough at add Linux support. That's the whole point of Go. There's no way the Homebrew tap should have ever just been for macOS in the first place. That's just silly @tomer-stripe
Have you done a PR for this?
No, because while GoReleaser does support generating a formula for both Linux and macOS, this repo uses different GoReleaser workflows for each platform and I’m not sure how to merge them.
please update your documentation, very poor. Wasted time installing brew and hit same error on Linux wsl. Now having to use windows
Still same problem, I do use brew for other stuff but still at least a linux no compatibility warning would be appreciated