Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

add operator-sdk version check to makefile #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ LOCAL=local
GRAFANA_OPERATOR_VERSION=v3.8.1
AMO_VERSION=1.5.1
PREV_AMO_VERSION=1.5.0

OPERATOR_SDK_VERSION=0.15.2
AUTH_TOKEN=$(shell curl -sH "Content-Type: application/json" -XPOST https://quay.io/cnr/api/v1/users/login -d '{"user": {"username": "$(QUAY_USERNAME)", "password": "${QUAY_PASSWORD}"}}' | jq -r '.token')

ifeq ($(shell operator-sdk version 2> /dev/null | sed -e 's/", .*/"/' -e 's/.* //'), "v$(OPERATOR_SDK_VERSION)")
OPERATOR_SDK ?= operator-sdk
else
OPERATOR_SDK ?= go run github.com/operator-framework/operator-sdk/cmd/operator-sdk
endif

.PHONY: setup/gomod
setup/gomod:
Expand All @@ -30,24 +35,24 @@ setup/gomod:
.PHONY: setup/travis
setup/travis:
@echo Installing Operator SDK
@curl -Lo operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v0.8.1/operator-sdk-v0.8.1-x86_64-linux-gnu && chmod +x operator-sdk && sudo mv operator-sdk /usr/local/bin/
@curl -Lo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v0.8.1/operator-sdk-v0.8.1-x86_64-linux-gnu && chmod +x operator-sdk && sudo mv operator-sdk /usr/local/bin/

.PHONY: code/run
code/run:
@operator-sdk up local --namespace=${NAMESPACE}
@$(OPERATOR_SDK) up local --namespace=${NAMESPACE}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this recipe is broken, should be something along the lines of @$(OPERATOR_SDK) run --local --namespace=${NAMESPACE} for <0.15.2


.PHONY: code/compile
code/compile:
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o=$(COMPILE_TARGET) ./cmd/manager

.PHONY: code/gen
code/gen:
operator-sdk generate k8s
$(OPERATOR_SDK) generate k8s

.PHONY: gen/csv
gen/csv:
sed -i.bak 's/image:.*/image: quay\.io\/integreatly\/application-monitoring-operator:v$(AMO_VERSION)/g' deploy/operator.yaml && rm deploy/operator.yaml.bak
@operator-sdk generate csv --operator-name=application-monitoring-operator --csv-version $(AMO_VERSION) --from-version $(PREV_AMO_VERSION) --update-crds --csv-channel=integreatly --default-channel
@$(OPERATOR_SDK) generate csv --operator-name=application-monitoring-operator --csv-version $(AMO_VERSION) --from-version $(PREV_AMO_VERSION) --update-crds --csv-channel=integreatly --default-channel
@sed -i.bak 's/$(PREV_AMO_VERSION)/$(AMO_VERSION)/g' deploy/olm-catalog/application-monitoring-operator/application-monitoring-operator.package.yaml && rm deploy/olm-catalog/application-monitoring-operator/application-monitoring-operator.package.yaml.bak
@sed -i.bak s/application-monitoring-operator:v$(PREV_AMO_VERSION)/application-monitoring-operator:v$(AMO_VERSION)/g deploy/olm-catalog/application-monitoring-operator/$(AMO_VERSION)/application-monitoring-operator.v$(AMO_VERSION).clusterserviceversion.yaml && rm deploy/olm-catalog/application-monitoring-operator/$(AMO_VERSION)/application-monitoring-operator.v$(AMO_VERSION).clusterserviceversion.yaml.bak

Expand All @@ -61,7 +66,7 @@ code/fix:

.PHONY: image/build
image/build: code/compile
@operator-sdk build ${REG}/${ORG}/${PROJECT}:${AMO_VERSION}
@$(OPERATOR_SDK) build ${REG}/${ORG}/${PROJECT}:${AMO_VERSION}

.PHONY: image/push
image/push:
Expand All @@ -72,7 +77,7 @@ image/build/push: image/build image/push

.PHONY: image/build/test
image/build/test:
operator-sdk build --enable-tests ${REG}/${ORG}/${PROJECT}:${AMO_VERSION}
$(OPERATOR_SDK) build --enable-tests ${REG}/${ORG}/${PROJECT}:${AMO_VERSION}

.PHONY: test/unit
test/unit:
Expand Down