forked from 3scale/3scale-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
101 lines (81 loc) · 3.33 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
.DEFAULT_GOAL := help
.PHONY: build e2e test-crds verify-manifest licenses-check push-manifest
UNAME := $(shell uname)
ifeq (${UNAME}, Linux)
SED=sed
else ifeq (${UNAME}, Darwin)
SED=gsed
endif
OPERATORCOURIER := $(shell command -v operator-courier 2> /dev/null)
LICENSEFINDERBINARY := $(shell command -v license_finder 2> /dev/null)
DEPENDENCY_DECISION_FILE = $(PROJECT_PATH)/doc/dependency_decisions.yml
help: Makefile
@sed -n 's/^##//p' $<
## vendor: Populate vendor directory
vendor:
@GO111MODULE=on go mod vendor
IMAGE ?= quay.io/3scale/3scale-operator
SOURCE_VERSION ?= master
VERSION ?= v0.0.1
NAMESPACE ?= operator-test
OPERATOR_NAME ?= threescale-operator
MANIFEST_RELEASE ?= 1.0.$(shell git rev-list --count master)
APPLICATION_REPOSITORY_NAMESPACE ?= 3scaleoperatormaster
## build: Build operator
build:
operator-sdk build $(IMAGE):$(VERSION)
## push: push operator docker image to remote repo
push:
docker push $(IMAGE):$(VERSION)
## pull: pull operator docker image from remote repo
pull:
docker pull $(IMAGE):$(VERSION)
tag:
docker tag $(IMAGE):$(SOURCE_VERSION) $(IMAGE):$(VERSION)
## local: push operator docker image to remote repo
local:
OPERATOR_NAME=$(OPERATOR_NAME) operator-sdk up local --namespace $(NAMESPACE)
## e2e-setup: create OCP project for the operator
e2e-setup:
oc new-project $(NAMESPACE)
## e2e-local-run: running operator locally with go run instead of as an image in the cluster
e2e-local-run:
OPERATOR_NAME=$(OPERATOR_NAME) operator-sdk test local ./test/e2e --up-local --namespace $(NAMESPACE) --go-test-flags '-v -timeout 0'
## e2e-run: operator local test
e2e-run:
operator-sdk test local ./test/e2e --go-test-flags '-v -timeout 0' --debug --image $(IMAGE) --namespace $(NAMESPACE)
## e2e-clean: delete operator OCP project
e2e-clean:
oc delete --force project $(NAMESPACE) || true
## e2e: e2e-clean e2e-setup e2e-run
e2e: e2e-clean e2e-setup e2e-run
## test-crds: Run CRD unittests
test-crds:
cd $(PROJECT_PATH)/test/crds && go test -v
## verify-manifest: Test manifests have expected format
verify-manifest:
ifndef OPERATORCOURIER
$(error "operator-courier is not available please install pip3 install operator-courier")
endif
cd $(PROJECT_PATH)/deploy/olm-catalog && operator-courier verify --ui_validate_io 3scale-operator-master/
## licenses.xml: Generate licenses.xml file
licenses.xml:
ifndef LICENSEFINDERBINARY
$(error "license-finder is not available please install: gem install license_finder --version 5.7.1")
endif
license_finder report --decisions-file=$(DEPENDENCY_DECISION_FILE) --quiet --format=xml > licenses.xml
## licenses-check: Check license compliance of dependencies
licenses-check: vendor
ifndef LICENSEFINDERBINARY
$(error "license-finder is not available please install: gem install license_finder --version 5.7.1")
endif
@echo "Checking license compliance"
license_finder --decisions-file=$(DEPENDENCY_DECISION_FILE)
## push-manifest: Push manifests to application repository
push-manifest:
ifndef OPERATORCOURIER
$(error "operator-courier is not available please install pip3 install operator-courier")
endif
cd $(PROJECT_PATH)/deploy/olm-catalog && operator-courier push 3scale-operator-master/ $(APPLICATION_REPOSITORY_NAMESPACE) 3scale-operator-master $(MANIFEST_RELEASE) "$(TOKEN)"