Skip to content

Commit 441e025

Browse files
author
Carlos Sanchez
committed
chore: fix build on homebrew
and remove deprecated yq --tojson
1 parent 57d348d commit 441e025

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() {
@@ -38,7 +39,7 @@ function crd_to_json_schema() {
3839
echo "apiextensions: ${api_version} documentIndex: ${document} | kind: ${kind} crd_kind: ${crd_kind} crd_group: ${crd_group}"
3940
crd_version=$(yq eval "select(documentIndex == ${document}) | .spec.version" "${input}")
4041
if [ -n "${crd_version}" ]; then
41-
yq eval --prettyPrint --tojson "select(documentIndex == ${document}) | .spec.validation.openAPIV3Schema" "${input}" | write_schema "${crd_kind}-${crd_group}-${crd_version}.json"
42+
yq eval --prettyPrint -o json "select(documentIndex == ${document}) | .spec.validation.openAPIV3Schema" "${input}" | write_schema "${crd_kind}-${crd_group}-${crd_version}.json"
4243
else
4344
for crd_version in $(yq eval "select(documentIndex == ${document}) | .spec.versions[].name" "${input}"); do
4445
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)