From ef15e572907266643eed90a5d191b18dd0f7bcc6 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Tue, 22 Feb 2022 15:19:23 +0100
Subject: [PATCH] Make sure correct version of operator-sdk is always used
(#728)
* Make sure the correct version of operator-sdk is always used
This PR installs operator-sdk to ./bin which makes sure
that always correct version of operator-sdk is used.
Signed-off-by: Pavol Loffay
* Create dir
Signed-off-by: Pavol Loffay
* Fix
Signed-off-by: Pavol Loffay
---
.github/workflows/continuous-integration.yaml | 4 ----
.github/workflows/release.yaml | 4 ----
.github/workflows/scorecard.yaml | 4 ----
Makefile | 17 +++++++----------
4 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml
index 4d0dc98fbc..e5acb26f7c 100644
--- a/.github/workflows/continuous-integration.yaml
+++ b/.github/workflows/continuous-integration.yaml
@@ -25,10 +25,6 @@ jobs:
- name: "install kustomize"
run: ./hack/install-kustomize.sh
- - uses: jpkrohling/setup-operator-sdk@v1.1.0
- with:
- operator-sdk-version: v1.17.0
-
- name: "basic checks"
run: make ci
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 1293072869..f648bb2365 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -21,10 +21,6 @@ jobs:
- name: "install kustomize"
run: ./hack/install-kustomize.sh
- - uses: jpkrohling/setup-operator-sdk@v1.1.0
- with:
- operator-sdk-version: v1.17.0
-
- name: "generate release resources"
run: make release-artifacts IMG_PREFIX="ghcr.io/open-telemetry/opentelemetry-operator"
diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml
index cefb8ac216..84ec971217 100644
--- a/.github/workflows/scorecard.yaml
+++ b/.github/workflows/scorecard.yaml
@@ -39,9 +39,5 @@ jobs:
- name: "wait until cluster is ready"
run: kubectl wait --timeout=5m --for=condition=available deployment/coredns -n kube-system
- - uses: jpkrohling/setup-operator-sdk@v1.1.0
- with:
- operator-sdk-version: v1.17.0
-
- name: "run scorecard test"
run: make scorecard-tests
diff --git a/Makefile b/Makefile
index b457120ce2..91071f6f64 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ endif
KUBE_VERSION ?= 1.21
KIND_CONFIG ?= kind-$(KUBE_VERSION).yaml
+OPERATOR_SDK_VERSION ?= 1.17.0
+
CERTMANAGER_VERSION ?= 1.6.1
ifndef ignore-not-found
@@ -152,7 +154,7 @@ prepare-e2e: kuttl set-test-image-vars set-image-controller container start-kind
$(KUSTOMIZE) build config/crd -o tests/_build/crds/
.PHONY: scorecard-tests
-scorecard-tests:
+scorecard-tests: operator-sdk
$(OPERATOR_SDK) scorecard -w=5m bundle || (echo "scorecard test failed" && exit 1)
.PHONY: set-test-image-vars
@@ -263,20 +265,15 @@ else
KIND=$(shell which kind)
endif
+OPERATOR_SDK = $(shell pwd)/bin/operator-sdk
.PHONY: operator-sdk
operator-sdk:
-ifeq (, $(shell which operator-sdk))
@{ \
set -e ;\
- echo "" ;\
- echo "ERROR: operator-sdk not found." ;\
- echo "Please check https://sdk.operatorframework.io for installation instructions and try again." ;\
- echo "" ;\
- exit 1 ;\
+ [ -d bin ] || mkdir bin ;\
+ curl -L -o $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}/operator-sdk_`go env GOOS`_`go env GOARCH`;\
+ chmod +x $(OPERATOR_SDK) ;\
}
-else
-OPERATOR_SDK=$(shell which operator-sdk)
-endif
# Generate bundle manifests and metadata, then validate generated files.
.PHONY: bundle