ceph: force yq and controller-gen versions
Let's not use any controllen-gen version we might find on the system, always pull the version we need. Same goes for yq. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
eac743ffc7
commit
cf00a86fc2
3 files changed
+8
-12
No files matched your search
@@ -15,9 +15,6 @@ jobs:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install yq
|
||||
run: sudo snap install yq --channel=v3/stable
|
||||
|
||||
- name: copy working directory to GOPATH
|
||||
run: sudo mkdir -p /home/runner/go/src/github.com && sudo cp -a /home/runner/work/rook /home/runner/go/src/github.com/
|
||||
|
||||
|
||||
@@ -175,23 +175,21 @@ csv-clean: ## Remove existing OLM files.
|
||||
@rm -fr cluster/olm/ceph/deploy/* cluster/olm/ceph/templates/*
|
||||
|
||||
controller-gen:
|
||||
ifeq (, $(shell command -v controller-gen))
|
||||
@{ \
|
||||
set -e ;\
|
||||
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
|
||||
cd $$CONTROLLER_GEN_TMP_DIR ;\
|
||||
go mod init tmp;\
|
||||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION);\
|
||||
go get github.com/mikefarah/yq/v3;\
|
||||
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
|
||||
}
|
||||
CONTROLLER_GEN=$(GOBIN)/controller-gen
|
||||
else
|
||||
CONTROLLER_GEN=$(shell command -v controller-gen)
|
||||
endif
|
||||
YQ=$(GOBIN)/yq
|
||||
|
||||
crds: controller-gen
|
||||
@echo Updating CRD manifests
|
||||
@build/crds/build-crds.sh $(CONTROLLER_GEN)
|
||||
@build/crds/build-crds.sh $(CONTROLLER_GEN) $(YQ)
|
||||
|
||||
.PHONY: all build.common cross.build.parallel
|
||||
.PHONY: build build.all install test check vet fmt codegen mod.check clean distclean prune
|
||||
|
||||
@@ -20,6 +20,7 @@ set -o pipefail
|
||||
|
||||
SCRIPT_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd -P)
|
||||
CONTROLLER_GEN_BIN_PATH=$1
|
||||
YQ_BIN_PATH=$2
|
||||
# allowDangerousTypes is used to accept float64
|
||||
CRD_OPTIONS="crd:trivialVersions=true,allowDangerousTypes=true"
|
||||
OLM_CATALOG_DIR="${SCRIPT_ROOT}/cluster/olm/ceph/deploy/crds"
|
||||
@@ -67,17 +68,17 @@ EOF
|
||||
|
||||
build_helm_resources() {
|
||||
# Add helm annotations to all CRDS
|
||||
yq w -i -d'*' "$HELM_CRDS_FILE_PATH" "metadata.annotations[helm.sh/resource-policy]" keep
|
||||
|
||||
"$YQ_BIN_PATH" w -i -d'*' "$HELM_CRDS_FILE_PATH" "metadata.annotations[helm.sh/resource-policy]" keep
|
||||
|
||||
# add header
|
||||
sed -i '1s/^/{{- if semverCompare ">=1.16.0" .Capabilities.KubeVersion.GitVersion }}\n/' "$HELM_CRDS_FILE_PATH"
|
||||
sed -i '1s/^/{{- if .Values.crds.enabled }}\n/' "$HELM_CRDS_FILE_PATH"
|
||||
|
||||
|
||||
echo "Generating helm resources.yaml"
|
||||
{
|
||||
# add else
|
||||
echo "{{- else }}"
|
||||
|
||||
|
||||
# add footer
|
||||
cat "$CRDS_BEFORE_1_16_FILE_PATH"
|
||||
# DO NOT REMOVE the empty line, it is necessary
|
||||
|
||||
Reference in new issue
Block a user