From 25303b79c91fc338a52cecde3c848d03d2dff602 Mon Sep 17 00:00:00 2001 From: irbekrm Date: Mon, 23 Aug 2021 07:08:51 +0100 Subject: [PATCH] Use yq instead of jq Because yq releases builds for darwin/arm Signed-off-by: irbekrm --- devel/addon/ingressnginx/install.sh | 6 +++--- devel/lib/lib.sh | 3 +-- hack/BUILD.bazel | 10 ---------- hack/bin/BUILD.bazel | 11 ----------- hack/bin/deps.bzl | 15 --------------- hack/update-deps-licenses.sh | 9 +-------- hack/update-deps.sh | 6 ++---- hack/verify-deps-licenses.sh | 6 ------ hack/verify-upgrade.sh | 4 ++-- 9 files changed, 9 insertions(+), 61 deletions(-) diff --git a/devel/addon/ingressnginx/install.sh b/devel/addon/ingressnginx/install.sh index 31a60a661..883b81b36 100755 --- a/devel/addon/ingressnginx/install.sh +++ b/devel/addon/ingressnginx/install.sh @@ -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 diff --git a/devel/lib/lib.sh b/devel/lib/lib.sh index 724fd55ec..0f010ffdc 100644 --- a/devel/lib/lib.sh +++ b/devel/lib/lib.sh @@ -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" diff --git a/hack/BUILD.bazel b/hack/BUILD.bazel index 4eea5b9f2..29675af2b 100644 --- a/hack/BUILD.bazel +++ b/hack/BUILD.bazel @@ -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", ], diff --git a/hack/bin/BUILD.bazel b/hack/bin/BUILD.bazel index b59f88359..3a28a49a2 100644 --- a/hack/bin/BUILD.bazel +++ b/hack/bin/BUILD.bazel @@ -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({ diff --git a/hack/bin/deps.bzl b/hack/bin/deps.bzl index 0b059e981..22afe172c 100644 --- a/hack/bin/deps.bzl +++ b/hack/bin/deps.bzl @@ -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/ diff --git a/hack/update-deps-licenses.sh b/hack/update-deps-licenses.sh index de09c106e..e089e5cb8 100755 --- a/hack/update-deps-licenses.sh +++ b/hack/update-deps-licenses.sh @@ -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 diff --git a/hack/update-deps.sh b/hack/update-deps.sh index 962d58e6d..e8e2a3d7c 100755 --- a/hack/update-deps.sh +++ b/hack/update-deps.sh @@ -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 diff --git a/hack/verify-deps-licenses.sh b/hack/verify-deps-licenses.sh index c6e5e9c2a..6ce51c19d 100755 --- a/hack/verify-deps-licenses.sh +++ b/hack/verify-deps-licenses.sh @@ -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" \ diff --git a/hack/verify-upgrade.sh b/hack/verify-upgrade.sh index a00ce7e47..055fba9ca 100755 --- a/hack/verify-upgrade.sh +++ b/hack/verify-upgrade.sh @@ -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"