Closed gnadaban closed 3 years ago
@ludusrusso @fabriziopandini How does brew build clusterctl?
Running make clusterctl
locally correctly calls hack/version.sh
to set the -ldflags
which then brings in the version
Tried to run brew install clusterctl --build-bottle
locally and it seems it also didn't get the version information
Further info: Seems that the tar downloaded from github (https://github.com/kubernetes-sigs/cluster-api/archive/refs/tags/v0.3.19.tar.gz
) doesn't contain .git
directory or any git information, which makes hack/version.sh
to fail to understand which version is it.
@vincepri uhm! How do you suggest to fix this? I think we need to change the hack/version.ah in some way to get the version!
I see that kubectl
uses git URL https://github.com/Homebrew/homebrew-core/blob/master/Formula/kubernetes-cli.rb . If we want to use git to detect the version, I think that's the way to go? 🤔
I see that we are currently using tar ball directly https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/clusterctl.rb
If we still want to go with hack/version.sh
(which totally uses git
) but without depending on git
, I think the popular way to go about it is simply override everything that's getting computed using git
by passing some environment variables. But then that could be considered a very hacky thing considering all the stuff that the hack/version.sh
script does
Can Homebrew be configured to get the release binaries instead? We could publish for more platforms if that's needed
I see this - https://docs.brew.sh/Acceptable-Formulae#we-dont-like-binary-formulae
Looking at CLI tools present in Cask - https://github.com/Homebrew/homebrew-cask/search?p=2&q=cli , I found concourse fly CLI using Cask https://github.com/Homebrew/homebrew-cask/blob/9b1e4b11e0e909d33306e2caf309d78b3d701833/Casks/fly.rb
Let's ask the homebrew maintainers what's the proper way to go?
@dawidd6 Any thoughts?
Just change to git URL.
Anyone has time to look at the above?
/kind bug /priority important-soon /milestone v0.4
/help
@fabriziopandini: This request has been marked as needing help from a contributor.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help
command.
This seems like a good first issue for new contributors. I'll try to pair with someone who is new and help them raise a PR, or I'll raise it myself
/assign
Observations-
Reproducible locally using brew install clusterctl
Based on above comments, to fix the issue we have replaced the tarball value with the GitHub URL here
Tested locally, it worked but were having issue related to git repo been dirty clusterctl version: &version.Info{Major:"0", Minor:"4", GitVersion:"v0.4.0-dirty", GitCommit:"7f879be68d15737e335b6cb39d380d1d163e06e6", GitTreeState:"dirty", BuildDate:"", GoVersion:"go1.16.6", Compiler:"gc", Platform:"darwin/amd64"}
Followed the Formula/kubernetes-cli.rb
file and added following code snippet to Formula/clusterctl.rb
file
Expected outcome- ➜ cluster-api git:(master) clusterctl version clusterctl version: &version.Info{Major:"0", Minor:"4", GitVersion:"v0.4.0", GitCommit:"7f879be68d15737e335b6cb39d380d1d163e06e6", GitTreeState:"clean", BuildDate:"", GoVersion:"go1.16.6", Compiler:"gc", Platform:"darwin/amd64"}
I will update the Homebrew PR details soon.
@karuppiah7890 Thank you so much for your help with this one. You are fab! 🎉
Homebrew PR submitted for this issue.
This issue can be closed 🚀 😄
https://github.com/Homebrew/homebrew-core/pull/82138 has been merged (using an automation). Commit - https://github.com/Homebrew/homebrew-core/commit/d9ad7fbdc9a70d612c0318bbdc5fd66222044b16
I tried a brew update and installed and it worked
$ brew remove clusterctl
Uninstalling /usr/local/Cellar/clusterctl/0.4.0... (5 files, 50.6MB)
$ brew update
Updated 5 taps (hashicorp/tap, homebrew/core, homebrew/cask, vmware-tanzu/carvel and vmware/internal).
==> New Formulae
notcurses sql-lint
==> Updated Formulae
awscli ✔ forge php@7.4
hashicorp/tap/nomad ✔ hashicorp/tap/terraform-ls phpstan
hugo ✔ jupyterlab pspg
nomad ✔ khal pulumi
vmware-tanzu/carvel/imgpkg ✔ ktlint qalculate-gtk
angular-cli libqalculate sceptre
apache-arrow libstatgrab snapcraft
apache-arrow-glib mill terraform-ls
apache-geode node tfsec
cdktf node-build vault
clusterctl node@12 vmware/internal/puzzle
cubejs-cli node@14 whistle
dolt pdm xplr
exploitdb php
==> New Casks
clock-signal memory-cleaner
==> Updated Casks
a-better-finder-attributes gramps plex-media-server
airtool integrity portfolioperformance
anki lagrange raycast
azure-data-studio lark renpy
calibre lastpass sentinel
chirp lingon-x simplenote
chromedriver lx-music smultron
chromium maltego snipaste
dmm-player marginnote spitfire-audio
dmm-player-for-chrome microsoft-azure-storage-explorer swinsian
downie microsoft-edge tencent-meeting
dteoh-devdocs modern-csv transmit
duplicacy museeks typeface
feishu origin yinxiangbiji
goland phpstorm
You have 9 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
$ brew info clusterctl
clusterctl: stable 0.4.0 (bottled), HEAD
Home for the Cluster Management API work, a subproject of sig-cluster-lifecycle
https://cluster-api.sigs.k8s.io
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/clusterctl.rb
License: Apache-2.0
==> Dependencies
Build: go ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 58 (30 days), 216 (90 days), 336 (365 days)
install-on-request: 58 (30 days), 216 (90 days), 336 (365 days)
build-error: 0 (30 days)
$ brew install clusterctl
==> Downloading https://ghcr.io/v2/homebrew/core/clusterctl/manifests/0.4.0_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/clusterctl/blobs/sha256:78f9971863e00fac134bb9aa6f9f4d27828917b8d502
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:78f9971863e00fac134bb9aa6f9f4d27
######################################################################## 100.0%
==> Pouring clusterctl--0.4.0_1.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/clusterctl/0.4.0_1: 5 files, 50.6MB
$ clusterctl
Get started with Cluster API using clusterctl to create a management cluster,
install providers, and create templates for your workload cluster.
Usage:
clusterctl [command]
Available Commands:
alpha Commands for features in alpha.
completion Output shell completion code for the specified shell (bash or zsh)
config Display clusterctl configuration.
delete Delete one or more providers from the management cluster.
describe Describe workload clusters.
generate Generate yaml using clusterctl yaml processor.
get Get info from a management or a workload cluster
help Help about any command
init Initialize a management cluster.
move Move Cluster API objects and all dependencies between management clusters.
upgrade Upgrade core and provider components in a management cluster.
version Print clusterctl version.
Flags:
--config $HOME/.cluster-api/clusterctl.yaml Path to clusterctl configuration (default is $HOME/.cluster-api/clusterctl.yaml) or to a remote location (i.e. https://example.com/clusterctl.yaml)
-h, --help help for clusterctl
-v, --v int Set the log level verbosity. This overrides the CLUSTERCTL_LOG_LEVEL environment variable.
Use "clusterctl [command] --help" for more information about a command.
$ clusterctl version
clusterctl version: &version.Info{Major:"0", Minor:"4", GitVersion:"v0.4.0", GitCommit:"7f879be68d15737e335b6cb39d380d1d163e06e6", GitTreeState:"clean", BuildDate:"", GoVersion:"go1.16.6", Compiler:"gc", Platform:"darwin/amd64"}
@gnadaban you could try a brew update
and then brew upgrade clusterctl
and it should work I think. Let us know!
/close
Thank you so much folks! Great work
@vincepri: Closing this issue.
What steps did you take and what happened:
Output:
What did you expect to happen:
clusterctl version
to output current version.Anything else you would like to add: N/A
Environment:
/etc/os-release
):Darwin <redacted> 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101 arm64
/kind bug [One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels]