Skip to content

Commit 75eaf05

Browse files
carlossgCarlos Sanchez
and
Carlos Sanchez
authored
chore: fix build on homebrew (#23)
and remove deprecated yq --tojson Co-authored-by: Carlos Sanchez <[email protected]>
1 parent 92e6104 commit 75eaf05

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ set -o nounset
55
set -o pipefail
66

77
# use homebrew cut if installed
8-
if [[ -d "/usr/local/opt/coreutils/libexec/gnubin" ]]; then
9-
PATH="/usr/local/opt/coreutils/libexec/gnubin:${PATH}"
8+
HOMEBREW_PREFIX="$(brew --prefix)"
9+
if [[ -d "${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin" ]]; then
10+
PATH="${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin:${PATH}"
1011
fi
1112

1213
function crd_to_json_schema() {
@@ -41,7 +42,7 @@ function crd_to_json_schema() {
4142
echo "apiextensions: ${api_version} documentIndex: ${document} | kind: ${kind} crd_kind: ${crd_kind} crd_group: ${crd_group}"
4243
crd_version=$(yq eval "select(documentIndex == ${document}) | .spec.version" "${input}")
4344
if [ -n "${crd_version}" ]; then
44-
yq eval --prettyPrint --tojson "select(documentIndex == ${document}) | .spec.validation.openAPIV3Schema" "${input}" | write_schema "${crd_kind}-${crd_group}-${crd_version}.json"
45+
yq eval --prettyPrint -o json "select(documentIndex == ${document}) | .spec.validation.openAPIV3Schema" "${input}" | write_schema "${crd_kind}-${crd_group}-${crd_version}.json"
4546
else
4647
for crd_version in $(yq eval "select(documentIndex == ${document}) | .spec.versions[].name" "${input}"); do
4748
yq eval --prettyPrint -o json "select(documentIndex == ${document}) | .spec.validation.openAPIV3Schema" "${input}" | write_schema "${crd_kind}-${crd_group}-${crd_version}.json"

0 commit comments

Comments
 (0)