kubernetes / contributor-site

Code for kubernetes.dev
https://www.kubernetes.dev
Apache License 2.0
63 stars 147 forks source link

./hack/gen-content.sh doesn't work on macOS #488

Open JamesLaverack opened 3 months ago

JamesLaverack commented 3 months ago

The ./hack/gen-content.sh script does not work on macOS, failing with:

$ ./hack/gen-content.sh
./hack/gen-content.sh: line 122: conditional binary operator expected

This is largely due to the outdated version of bash shipped with macOS. Even if you account for that issue, the flags used to grep and sed don't work on BSD grep/sed distributed with macOS

JamesLaverack commented 3 months ago

Don't do what I did, but this is one "workaround":

diff --git a/hack/.gitignore b/hack/.gitignore
new file mode 100644
index 0000000..1757ae4
--- /dev/null
+++ b/hack/.gitignore
@@ -0,0 +1 @@
+tmp.sh
diff --git a/hack/gen-content-macos.sh b/hack/gen-content-macos.sh
new file mode 100755
index 0000000..fcbe0f9
--- /dev/null
+++ b/hack/gen-content-macos.sh
@@ -0,0 +1,6 @@
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cat ./hack/gen-content.sh | gsed 's/sed/gsed/g' | gsed 's/grep/ggrep/g' > ./hack/tmp.sh
+$(brew --prefix)/bin/bash ./hack/tmp.sh
stmcginnis commented 3 months ago

/kind bug

k8s-triage-robot commented 2 weeks ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale