-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
kubecfg 0.8.0 (new formula) #25737
kubecfg 0.8.0 (new formula) #25737
Conversation
This is a Kubernetes tool developed at Bitnami. It is a prerequisite for some development tasks with the better-known Kubeless project (http://kubeless.io/docs/dev-guide/). It should not be confused with the identically-named, defunct precursor to kubectl. I am slightly concerned that it doesn't have its own website, except for its Github repository and a couple of YouTube videos. But a quick survey shows that 25% of homebrew-core formulae have homepages in the github.com domain, so I suspect it's OK. The "gopath shenanigans" mentioned in a comment seem to be a new requirement with Go 1.10. Previous Go releases let you get away with a symlink to buildpath, but 1.10 refuses to recognise the "vendor" directory if it's found via a symlink.
Thanks @aecolley for the PR, much appreciated !, will loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the formula and the installation, audit and test worked as expected. I just made some small comments. Apart from that wait for brew maintainers to have more details about other requirements they may have. Thanks!
Formula/kubecfg.rb
Outdated
class Kubecfg < Formula | ||
desc "Manage complex enterprise Kubernetes environments as code" | ||
homepage "https://github.com/ksonnet/kubecfg" | ||
url "https://github.com/ksonnet/kubecfg/archive/v0.7.2.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for making it easier to update you can use the github repo as url
and the tag and commit as versions:
url "https://github.com/ksonnet/kubecfg.git"
:tag => "v0.7.2",
:revision => "7c1e6e59cc5cdf7259f17d349e55b6287b419b13"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While that works fine, the Acceptable Formulae document says:
Tarballs are preferred to Git checkouts, and tarballs should include the version in the filename whenever possible.
Unless you specifically overrule that, I'm inclined to hew closely to it.
Formula/kubecfg.rb
Outdated
args.push("VERSION=#{version}") unless build.head? | ||
system "make", "generate", *args if build.head? | ||
system "make", *args | ||
system "make", "test", *args if build.head? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the make test
task if possible to the test
hook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, but I'm not sure it's possible. The Formula API says that buildpath
is only non-nil inside the install
method. I don't see another way to find the extracted source code, or even a way to provoke its recreation. The man page describes brew test
as something that
should generally indicate to the user if something is wrong with the installed formula.
Formula/kubecfg.rb
Outdated
end | ||
|
||
test do | ||
system "#{bin}/kubecfg", "show", "#{share}/lib/kubecfg_test.jsonnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would compare the output of this command with an expected result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to compare the output. The test file uses asserts everywhere and is designed to cause a non-zero exit on failure. The "success" value
is just the bare minimum designed to cause kubecfg to exit successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted this after reading @anguslees' reply.
Formula/kubecfg.rb
Outdated
sharelib = share/"lib" | ||
sharelib.mkpath | ||
sharelib.install srcdir/"lib/kubecfg.libsonnet" | ||
sharelib.install srcdir/"lib/kubecfg_test.jsonnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This _test lib is not relevant for an end user, and doesn't need to be installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. I installed it only so it would be available for the test mode. If you come up with a good one-liner (for values of one up to 5) which tests the most basic functionality of kubecfg
, I'll happily substitute it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see - the homebrew "test" is on the installed result, not the intermediate build artifacts. In that case, it's a reasonable test 👍
Formula/kubecfg.rb
Outdated
bin.install srcdir/"kubecfg" | ||
sharelib = share/"lib" | ||
sharelib.mkpath | ||
sharelib.install srcdir/"lib/kubecfg.libsonnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the next and future releases (from vmware-archive/kubecfg#197) won't need this file to be separately installed - it now embeds kubecfg.libsonnet in the binary.
Current (and past) releases do need this separately installed, however.
Edit: Ah! I see from the caveats
text below, that you're already aware of this, and just installing it as a reference for the user. Nice move.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought it was already embedded in 0.7.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I included a tiny patch to inject the share/lib
directory at the end of the search path. import "kubecfg.jsonnet"
now looks in the right place. Obviously it should go on the next release with the internalfs stuff obviating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed for 0.8.0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but it's used in the brew test
block.
Formula/kubecfg.rb
Outdated
cd srcdir do | ||
args = [] | ||
args.push("VERSION=#{version}") unless build.head? | ||
system "make", "generate", *args if build.head? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make generate
(and go-bindata) are only required at dev-time, and the up-to-date generated file is supposed to be already included in git repo. .. So I think you should remove this step (and go-bindata dependency) from the homebrew formula.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simpler is better, so I'll do that.
Formula/kubecfg.rb
Outdated
end | ||
|
||
test do | ||
system "#{bin}/kubecfg", "show", "#{share}/lib/kubecfg_test.jsonnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to compare the output. The test file uses asserts everywhere and is designed to cause a non-zero exit on failure. The "success" value
is just the bare minimum designed to cause kubecfg to exit successfully.
This reverts commit 55ca312.
Formula/kubecfg.rb
Outdated
# The real build steps: | ||
cd srcdir do | ||
args = [] | ||
args.push("VERSION=#{version}") unless build.head? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does #{version}
look like once expanded? It would be good if it matched the regular kubecfg upstream release builds, which use git tag - eg v0.7.2
(including the v
) and not just 0.7.2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the v.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
(and hi aecolley! :)
…associated lies from caveats
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(still lgtm)
"At least 6 approving reviews are required by reviewers with write access." Wow. |
@fxcoudert is this ready for review, or is there something else I should do first? (Nice work on #26034 by the way!) |
@fxcoudert two-week ping |
@BrewTestBot test this please |
Formula/kubecfg.rb
Outdated
homepage "https://github.com/ksonnet/kubecfg" | ||
url "https://github.com/ksonnet/kubecfg/archive/v0.8.0.tar.gz" | ||
sha256 "25d054af96a817bad0f33998895a9988c187e1399822c8220528e64f56ccb3ae" | ||
head "https://github.com/ksonnet/kubecfg.git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove head
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? I will comply, but I suggest that the Acceptable Formulae document should document the deprecation of head
and any conditions that apply.
Formula/kubecfg.rb
Outdated
bin.install srcdir/"kubecfg" | ||
sharelib = share/"lib" | ||
sharelib.mkpath | ||
sharelib.install srcdir/"lib/kubecfg.libsonnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed for 0.8.0
?
Formula/kubecfg.rb
Outdated
def install | ||
ENV["GOPATH"] = buildpath | ||
srcdir = buildpath/"src/github.com/ksonnet/kubecfg" | ||
srcdir.install buildpath.children - [buildpath/".brew_home"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/ksonnet/kubecfg").install buildpath.children
cd "src/github.com/ksonnet/kubecfg" do
system "make", "VERSION=v#{version}"
bin.install "kubecfg"
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added.
@BrewTestBot test this please |
Is there something further I should do here? |
@BrewTestBot test this please |
Formula/kubecfg.rb
Outdated
end | ||
|
||
test do | ||
system bin/"kubecfg", "show", pkgshare/"kubecfg_test.jsonnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we match the output?
output = shell_output("#{bin}/kubecfg show #{pkgshare}/kubecfg_test.jsonnet")
assert_match "result: SUCCESS", output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command spawned by shell_output
uses its exit status to indicate success or failure. The kubecfg_test.jsonnet
uses assertions to carry out all of its testing, and the output is trivial. We already discussed this earlier in this PR.
Formula/kubecfg.rb
Outdated
(zsh_completion/"_kubecfg").write output | ||
end | ||
|
||
def caveats; <<~EOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a standard location for Homebrew so I don't think we need this caveat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: never mind, I see now the deletion that made my comment obsolete.
Without the caveat, the user would naturally assume that the installed file is used by the kubecfg
binary, and therefore that editing the file would be a way to debug it. The truth is that editing the file would be a waste of time. It is installed as a form of documentation, nothing more. Also, this is the only mention of the KUBECFG_JPATH
feature, other than the source code. I freely admit I'm abusing caveats
as documentation.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@BrewTestBot test this please |
Thanks for your first contribution to Homebrew, and your patience, @aecolley! You're awesome. |
This is a Kubernetes tool developed at Bitnami. It is a prerequisite
for some development tasks with the better-known Kubeless project
(http://kubeless.io/docs/dev-guide/). It should not be confused with
the identically-named, defunct precursor to kubectl.
I am slightly concerned that it doesn't have its own website, except
for its Github repository and a couple of YouTube videos. But a quick
survey shows that 25% of homebrew-core formulae have homepages in
the github.com domain, so I suspect it's OK.
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?