-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (77 loc) · 3.25 KB
/
Makefile
File metadata and controls
100 lines (77 loc) · 3.25 KB
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
all: build
.PHONY: all
SOURCE_GIT_TAG ?=$(shell git describe --long --tags --abbrev=7 --match 'v[0-9]*' || echo 'v1.0.0-$(SOURCE_GIT_COMMIT)')
SOURCE_GIT_COMMIT ?=$(shell git rev-parse --short "HEAD^{commit}" 2>/dev/null)
# Use go.mod go version as a single source of truth of Ginkgo version.
GINKGO_VERSION ?= $(shell go list -m -f '{{.Version}}' github.com/onsi/ginkgo/v2)
GOLANGCI_LINT = $(shell pwd)/_output/tools/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v2.8.0
# OS_GIT_VERSION is populated by ART
# If building out of the ART pipeline, fallback to SOURCE_GIT_TAG
ifndef OS_GIT_VERSION
OS_GIT_VERSION = $(SOURCE_GIT_TAG)
endif
# Include the library makefile
include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
golang.mk \
targets/openshift/images.mk \
targets/openshift/deps.mk \
)
# Exclude e2e tests from unit testing
GO_TEST_PACKAGES :=./pkg/... ./cmd/...
IMAGE_REGISTRY :=registry.ci.openshift.org
# This will call a macro called "build-image" which will generate image specific targets based on the parameters:
# $0 - macro name
# $1 - target name
# $2 - image ref
# $3 - Dockerfile path
# $4 - context directory for image build
$(call build-image,ocp-jobset-operator,$(IMAGE_REGISTRY)/ocp/4.20:jobset-operator, ./Dockerfile,.)
$(call verify-golang-versions,Dockerfile)
GINKGO = $(shell pwd)/_output/tools/bin/ginkgo
.PHONY: ginkgo
ginkgo: ## Download ginkgo locally if necessary.
test -s $(shell pwd)/_output/tools/bin/ginkgo || GOFLAGS=-mod=readonly GOBIN=$(shell pwd)/_output/tools/bin go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION)
test-e2e: ginkgo
RUN_OPERATOR_TEST=true GINKGO=$(GINKGO) hack/e2e-test.sh
.PHONY: test-e2e
test-e2e-operand: ginkgo
RUN_OPERAND_TEST=true GINKGO=$(GINKGO) hack/e2e-test.sh
.PHONY: test-e2e
regen-crd:
go build -o _output/tools/bin/controller-gen ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen
rm manifests/jobset-operator.crd.yaml
./_output/tools/bin/controller-gen crd paths=./pkg/apis/openshiftoperator/v1/... output:crd:dir=./manifests
mv manifests/operator.openshift.io_jobsetoperators.yaml manifests/jobset-operator.crd.yaml
cp manifests/jobset-operator.crd.yaml deploy/00_jobset-operator.crd.yaml
generate-clients:
GO=GO111MODULE=on GOFLAGS=-mod=readonly hack/update-codegen.sh
.PHONY: generate-clients
generate-controller-manifests:
hack/update-jobset-controller-manifests.sh
.PHONY: generate-controller-manifests
update-cluster-service-version:
hack/update-cluster-service-version.sh
.PHONY: update-cluster-service-version
generate: generate-clients regen-crd generate-controller-manifests update-cluster-service-version
.PHONY: generate
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
}
.PHONY: golangci-lint
lint: golangci-lint
$(GOLANGCI_LINT) run --verbose --print-resources-usage
.PHONY: lint
verify-codegen:
GO=GO111MODULE=on GOFLAGS=-mod=readonly hack/verify-codegen.sh
.PHONY: verify-codegen
verify-controller-manifests:
hack/verify-jobset-controller-manifests.sh
.PHONY: verify-controller-manifests
clean:
$(RM) ./jobset-operator
$(RM) -r ./_tmp
$(RM) -r ./_output
.PHONY: clean