From a1e78ea29b17b4ff7e0095a76a1bd3f7bd835012 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 15 Jan 2025 13:22:50 -0500 Subject: [PATCH] Use local yq for bindata This can introduce ordering issues and should solve renovate a renovate issue --- Makefile | 3 ++- hack/sync-bindata.sh | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 63ad826e7..e8baadf22 100644 --- a/Makefile +++ b/Makefile @@ -146,7 +146,8 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." .PHONY: bindata -bindata: kustomize yq ## Build docker image with the manager. +bindata: export LOCAL_BINARIES=$(LOCALBIN) +bindata: kustomize yq ## Call sync bindata script mkdir -p bindata/crds bindata/rbac bindata/operator $(KUSTOMIZE) build config/crd > bindata/crds/crds.yaml $(KUSTOMIZE) build config/default > bindata/operator/operator.yaml diff --git a/hack/sync-bindata.sh b/hack/sync-bindata.sh index a3ed2a396..8aca065e2 100755 --- a/hack/sync-bindata.sh +++ b/hack/sync-bindata.sh @@ -7,6 +7,7 @@ set -ex OUT_DATA=bindata EXTRACT_DIR=tmp/bindata +LOCAL_BINARIES=${LOCAL_BINARIES:?} mkdir -p "$EXTRACT_DIR" mkdir -p "$OUT_DATA/crds" @@ -25,7 +26,7 @@ local CSV_FILENAME=$1 local OPERATOR_NAME=$2 local TYPE=$3 -cat $CSV_FILENAME | yq -r ".spec.webhookdefinitions.[] | select(.type == \"$TYPE\")" | \ +cat $CSV_FILENAME | $LOCAL_BINARIES/yq -r ".spec.webhookdefinitions.[] | select(.type == \"$TYPE\")" | \ sed -e '/^containerPort:/d' | \ sed -e '/^deploymentName:/d' | \ sed -e '/^targetPort:/d' | \ @@ -152,9 +153,9 @@ grep -l CustomResourceDefinition manifests/* | xargs -I % sh -c 'cp % ./crds/' for X in $(ls manifests/*clusterserviceversion.yaml); do OPERATOR_NAME=$(echo $X | sed -e "s|manifests\/\([^\.]*\)\..*|\1|") echo $OPERATOR_NAME - LEADER_ELECTION_ROLE_RULES=$(cat $X | yq -r .spec.install.spec.permissions | sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d' + LEADER_ELECTION_ROLE_RULES=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.permissions | sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d' ) - CLUSTER_ROLE_RULES=$(cat $X | yq -r .spec.install.spec.clusterPermissions| sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d' + CLUSTER_ROLE_RULES=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.clusterPermissions| sed -e 's|- rules:|rules:|' | sed -e 's| ||' | sed -e '/ serviceAccountName.*/d' ) if [[ "$OPERATOR_NAME" == "infra-operator" ]]; then @@ -271,9 +272,9 @@ for X in $(ls manifests/*clusterserviceversion.yaml); do OPERATOR_NAME=$(echo $X | sed -e "s|manifests\/\([^\.]*\)\..*|\1|" | sed -e "s|-|_|g" | tr '[:lower:]' '[:upper:]' ) echo $OPERATOR_NAME if [[ $OPERATOR_NAME == "RABBITMQ_CLUSTER_OPERATOR" ]]; then - IMAGE=$(cat $X | yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[0].image) + IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[0].image) else - IMAGE=$(cat $X | yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[1].image) + IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[1].image) fi echo $IMAGE