Use yq instead of jq

Because yq releases builds for darwin/arm

Signed-off-by: irbekrm <irbekrm@gmail.com>
This commit is contained in:
irbekrm 2021-08-23 07:08:51 +01:00
parent ba3864e3c9
commit 25303b79c9
9 changed files with 9 additions and 61 deletions

View File

@ -36,10 +36,10 @@ fi
RELEASE_NAME="${RELEASE_NAME:-ingress-nginx}"
IMAGE_TAG=""
# Require helm, kubectl and jq available on PATH
# Require helm, kubectl and yq available on PATH
check_tool kubectl
check_tool helm
bazel build //hack/bin:jq
bazel build //hack/bin:yq
bindir="$(bazel info bazel-bin)"
export PATH="${bindir}/hack/bin/:$PATH"
@ -52,7 +52,7 @@ export PATH="${bindir}/hack/bin/:$PATH"
# This allows running ./devel/setup-e2e-deps.sh locally against Kubernetes v1.22
# without passing the K8S_VERSION env var.
k8s_version=$(kubectl version -ojson | jq -r '.serverVersion | "\(.major).\(.minor)"')
k8s_version=$(kubectl version -oyaml | yq e '.serverVersion | .major +"."+ .minor' -)
if [[ $k8s_version =~ 1\.22 ]]; then
IMAGE_TAG="v1.0.0-alpha.2"
else

View File

@ -39,7 +39,7 @@ export INGRESS_IP="${SERVICE_IP_PREFIX}.15"
# versions of the tools required for development
setup_tools() {
check_bazel
bazel build //hack/bin:helm //hack/bin:kind //hack/bin:kubectl //hack/bin:jq //devel/bin:ginkgo
bazel build //hack/bin:helm //hack/bin:kind //hack/bin:kubectl //devel/bin:ginkgo
if [[ "$IS_OPENSHIFT" == "true" ]] ; then
bazel build //hack/bin:oc3
fi
@ -47,7 +47,6 @@ setup_tools() {
export HELM="${bindir}/hack/bin/helm"
export KIND="${bindir}/hack/bin/kind"
export OC3="${bindir}/hack/bin/oc3"
export JQ="${bindir}/hack/bin/jq"
export KUBECTL="${bindir}/hack/bin/kubectl"
export KUSTOMIZE="${bindir}/hack/bin/kustomize"
export GINKGO="${bindir}/devel/bin/ginkgo"

View File

@ -10,8 +10,6 @@ GOROOT = "@go_sdk//:files"
GOFMT = "@go_sdk//:bin/gofmt"
JQ = "//hack/bin:jq"
YQ = "//hack/bin:yq"
CONTROLLER_GEN = "@io_k8s_sigs_controller_tools//cmd/controller-gen"
@ -73,7 +71,6 @@ sh_binary(
"$(location %s)" % GO,
"$(location %s)" % GAZELLE,
"$(location %s)" % KAZEL,
"$(location %s)" % JQ,
"$(location :update-bazel)",
"$(location :update-deps-licenses)",
],
@ -81,7 +78,6 @@ sh_binary(
GAZELLE,
GO,
KAZEL,
JQ,
":update-bazel",
":update-deps-licenses",
],
@ -95,7 +91,6 @@ sh_test(
"$(location %s)" % GO,
"$(location %s)" % GAZELLE,
"$(location %s)" % KAZEL,
"$(location %s)" % JQ,
"$(location :update-bazel)",
"$(location :update-deps-licenses)",
],
@ -104,7 +99,6 @@ sh_test(
GAZELLE,
GO,
KAZEL,
JQ,
":update-bazel",
":update-deps-licenses",
"@//:all-srcs",
@ -117,11 +111,9 @@ sh_binary(
srcs = ["update-deps-licenses.sh"],
args = [
"$(location %s)" % GO,
"$(location %s)" % JQ,
],
data = [
GO,
JQ,
],
)
@ -131,13 +123,11 @@ sh_test(
args = [
"$(location :update-deps-licenses)",
"$(location %s)" % GO,
"$(location %s)" % JQ,
],
data = [
GAZELLE,
GO,
KAZEL,
JQ,
":update-deps-licenses",
"@//:all-srcs",
],

View File

@ -2,17 +2,6 @@ package(default_visibility = ["//visibility:public"])
load("@io_k8s_repo_infra//defs:run_in_workspace.bzl", "workspace_binary")
genrule(
name = "fetch_jq",
srcs = select({
":darwin": ["@jq_osx//file"],
":k8": ["@jq_linux//file"],
}),
outs = ["jq"],
cmd = "cp $(SRCS) $@",
visibility = ["//visibility:public"],
)
genrule(
name = "fetch_helm",
srcs = select({

View File

@ -68,21 +68,6 @@ filegroup(
""",
)
def install_misc():
http_file(
name = "jq_linux",
executable = 1,
sha256 = "af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44",
urls = ["https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64"],
)
http_file(
name = "jq_osx",
executable = 1,
sha256 = "5c0a0a3ea600f302ee458b30317425dd9632d1ad8882259fcaf4e9b868b2b1ef",
urls = ["https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64"],
)
# Install dependencies used by the controller-runtime integration test framework
# Use these links to check for new versions:
# https://console.developers.google.com/storage/kubebuilder-tools/

View File

@ -50,7 +50,6 @@ else
fi
go=$(realpath "$1")
jq=$(realpath "$2")
export PATH=$(dirname "$go"):$PATH
shift 2
@ -163,12 +162,6 @@ export GOFLAGS=-mod=mod
if (( BASH_VERSINFO[0] < 4 )); then
echo
echo "ERROR: Bash v4+ required."
# Extra help for OSX
if [[ "$(uname -s)" == "Darwin" ]]; then
echo
echo "Ensure you are up to date on the following packages:"
echo "$ brew install md5sha1sum bash jq"
fi
echo
exit 9
fi
@ -240,7 +233,7 @@ only_contains_submodules () {
}
# Loop through every vendored package
for PACKAGE in $("$go" list -m -json all | "$jq" -r .Path | sort -f); do
for PACKAGE in $("$go" list -m -f '{{.Path}}' all | sort -f); do
if [[ -e "staging/src/${PACKAGE}" ]]; then
echo "${PACKAGE} is a staging package, skipping" >&2
continue

View File

@ -40,16 +40,14 @@ go=$(realpath "$1")
export PATH=$(dirname "$go"):$PATH
gazelle=$(realpath "$2")
kazel=$(realpath "$3")
jq=$(realpath "$4")
update_bazel=(
$(realpath "$5")
$(realpath "$4")
"$gazelle"
"$kazel"
)
update_deps_licenses=(
$(realpath "$6")
$(realpath "$5")
"$go"
"$jq"
)
shift 6

View File

@ -47,12 +47,6 @@ tmpfiles=$TEST_TMPDIR/files
"$@"
)
(
# Remove the platform/binary for gazelle and kazel
jq=$(dirname "$3")
rm -rf {.,"$tmpfiles"}/{"$jq"}
)
# Avoid diff -N so we handle empty files correctly
diff=$(diff -upr \
-x ".git" \

View File

@ -29,9 +29,9 @@ kube::version::last_published_release
LATEST_RELEASE="${KUBE_LAST_RELEASE}"
CURRENT_VERSION="${KUBE_GIT_VERSION}"
# Ensure helm, kind, kubectl, ytt, jq are available
# Ensure helm, kind, kubectl, ytt are available
echo "Building the required tools.."
bazel build //hack/bin:helm //hack/bin:kind //hack/bin:ytt //hack/bin:jq //hack/bin:kubectl //hack/bin:kubectl-cert_manager
bazel build //hack/bin:helm //hack/bin:kind //hack/bin:ytt //hack/bin:kubectl //hack/bin:kubectl-cert_manager
bindir="$(bazel info bazel-bin)"
export PATH="${bindir}/hack/bin/:$PATH"