Open jedsalazar opened 4 years ago
Could you assign this issue to me? I have done some work already for homebrew. I might be available to work on other package manager but not guarantees.
Homebrew recommends that the formula builds the target using a tarballed source. The github release of this tarballed source omit the '.git' directory, so git commands ran in the Makefile fail.
I have two PR's that solve this issue in slightly different ways and have no strong preference to which one is chosen.
https://github.com/cilium/hubble/compare/master...zhiyanfoo:makefile-command-brew-opt1 https://github.com/cilium/hubble/compare/master...zhiyanfoo:makefile-command-brew-opt2
Alternatively we could have the formula clone the repo, omitting the need to modify the makefile. Glancing through the current accepted formulas, very few repositories go through this route.
The below formula should work nonetheless. Also available from https://github.com/zhiyanfoo/homebrew-experimental-tap.
You can try it by running
brew tap zhiyanfoo/experimental-tap
and brew install hubble
.
require 'open3'
class Hubble < Formula
desc "Hubble - Network, Service & Security Observability for Kubernetes using eBPF"
homepage "https://github.com/cilium/hubble"
url "https://github.com/cilium/hubble.git",
tag: "v0.8.0"
license "Apache-2.0"
head "https://github.com/cilium/hubble.git"
depends_on "go" => :build
def install
system 'make', 'hubble'
bin.install 'hubble'
end
test do
_, _, status = Open3.capture3("#{bin}/hubble", "version")
assert_equal 0, status
end
end
So to summarize
@zhiyanfoo Awesome! I assigned the issue to you.
Option 2 is definitely the way to go as this is how it was intended to work (note that || printf ''
can be omitted from your patch as it's redundant).
- Do we use the github release tarball or clone the git repo?
- If the former which PR to modify the Makefile?
- What other package managers would you like hubble to be available on?
GIT_BRANCH = $(shell which git >/dev/null 2>&1 && git rev-parse --abbrev-ref HEAD 2>/dev/null)
GIT_HASH = $(shell which git >/dev/null 2>&1 && git rev-parse --short HEAD 2>/dev/null)
PR https://github.com/cilium/hubble/pull/589/files with printf ''
removed
With the next release I believe we can submit something like this to https://github.com/Homebrew/homebrew-core
require 'open3'
class Hubble < Formula
desc "Hubble - Network, Service & Security Observability for Kubernetes using eBPF"
homepage "https://github.com/cilium/hubble"
url "https://github.com/cilium/hubble/archive/refs/tags/v0.9.0.tar.gz",
license "Apache-2.0"
head "https://github.com/cilium/hubble.git"
depends_on "go" => :build
def install
system 'make', 'hubble'
bin.install 'hubble'
end
test do
_, _, status = Open3.capture3("#{bin}/hubble", "version")
assert_equal 0, status
end
end
@zhiyanfoo I've marked your PR for backport to the v0.8 branch so that we can release v0.8.1 with the fix.
I've opened a PR to add hubble as a formula
brew formula merged. https://github.com/Homebrew/homebrew-core/pull/81876. I've managed to install via brew install hubble
.
I’m going through the kind install hubble-relay section which has users download the
darwin-amd64
image for the hubble binary on the hubble/releases/download page. I’m thinking we should supply this binary in a package manager likebrew
(as well as other package managers for windows and Linux) so users automatically stay up-to-date without manually updating from the releases page.This will likely save us confusion in the long-run as we won't have to consistently be asking what version of the local hubble binary was installed. It's also a better operator experience as most critical binaries on an operator's machine are installed and lifecycle-managed through package managers.