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 homebrew custom tap #1849

Closed
wants to merge 12 commits into from
Closed

Add homebrew custom tap #1849

wants to merge 12 commits into from

Conversation

nitrocode
Copy link
Member

@nitrocode nitrocode commented Nov 17, 2021

what

  • Add homebrew custom tap
  • Figure out how to ship binaries
    • Homebrew has a concept of bottling where it will build a binary, add a sha, and upload it as a github package.
    • We probably want to be consistent and ship the binaries by running the install target in the vendored package Makefile
  • Add generated formula for each vendored app
  • Allow update action to regenerate formula
    • The package-template.yaml seems to be the correct place to run an additional make target

notable changes for reviewers

why

  • Give users another method of installing binaries

references

commands

Eventually, it will be easy as this

brew tap cloudposse/packages https://github.com/cloudposse/packages.git

For now, after running the above command, the correct branch will also have to be checked out

cd /usr/local/Homebrew/Library/Taps/cloudposse/homebrew-packages
git checkout homebrew
brew install cloudposse/packages/atmos
$ brew search cloudposse/packages
==> Formulae
cloudposse/packages/atmos
$ brew install cloudposse/packages/atmos
==> Cloning https://github.com/cloudposse/packages.git
Cloning into '/Users/user/Library/Caches/Homebrew/atmos--git'...
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
==> Installing atmos from cloudposse/packages
==> make install
🍺  /usr/local/Cellar/atmos/1.3.9: 5 files, 7.6MB, built in 7 seconds
$ which atmos
/usr/local/bin/atmos
$ ls -la /usr/local/bin/atmos
lrwxr-xr-x 1 user admin 31 Nov 17 12:21 /usr/local/bin/atmos -> ../Cellar/atmos/1.3.9/bin/atmos*
$ atmos version
1.3.9
generate formula
$ ✗ cat generate.sh
PACKAGE=${1:-atmos}
PACKAGE_FORMATTED=$(echo $PACKAGE | sed -e 's/-/ /g' -e 's/\b\(.\)/\u\1/g' -e 's/ //g')
VERSION=$(cat vendor/$PACKAGE/VERSION)
DESCRIPTION=$(cat vendor/$PACKAGE/DESCRIPTION)

cat << EOT
class $PACKAGE_FORMATTED < Formula
  desc "$DESCRIPTION"
  url "https://github.com/cloudposse/packages.git"
  version "$VERSION"

  def install
    ENV["INSTALL_PATH"] = "cloudposse"
    chdir "vendor/$PACKAGE" do
      system "make", "install"
      bin.install "cloudposse/$PACKAGE"
    end
  end
end
EOT

$ ls vendor/ | grep '/' | cut -d'/' -f1 | while read package; do ./generate.sh $package > HomebrewFormula/$package.rb; done

@github-actions github-actions bot removed the scripts label Nov 17, 2021
@nitrocode nitrocode marked this pull request as ready for review November 17, 2021 20:41
Copy link
Contributor

@Nuru Nuru left a comment

Choose a reason for hiding this comment

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

@nitrocode @osterman I haven't finished my review, but so far, I think we should:

  • Enable/disable Homebrew formulae the way we enable/disable rpm packages
  • Not publish formulae that duplicate those maintained in homebrew/core (with the possible exception of atmos)
  • Probably not publish formulae for the few packages we compile (e.g. terraform-config-inspect) because it is too much work to set up the formulae to have the right dependencies to build on the target host
  • Either don't publish or come up with a better strategy for installing/naming the version-pinned packages like kubectl-1.18

Also, as far as I have seen so far, there is nothing checking these formulae into git/GitHub. Perhaps we should create a Homebrew tap repo (cloudposse/homebrew-tap) and update it from the release build or have it update itself.

@nitrocode
Copy link
Member Author

Will get to this eventually. I'll close for now until this is a priority.

@nitrocode nitrocode closed this May 5, 2022
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.

Publish Homebrew Formulae
2 participants