forked from open-component-model/ocm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
89 lines (69 loc) · 2.78 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
NAME = helmdemo
PROVIDER ?= ocm.software
GITHUBORG ?= open-component-model
IMAGE = $(NAME)
COMPONENT = $(PROVIDER)/toi/demo/$(NAME)
OCMREPO ?= ghcr.io/$(GITHUBORG)/ocm
HELMINSTCOMP = $(PROVIDER)/toi/installers/helminstaller
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION := $(shell go run $(REPO_ROOT)/pkg/version/generate/release_generate.go print-rc-version)
COMMIT = $(shell git rev-parse HEAD)
EFFECTIVE_VERSION = $(VERSION)-$(COMMIT)
HELMINSTVERSION ?= $(VERSION)
CREDS := $(shell $(REPO_ROOT)/hack/githubcreds.sh)
OCM = go run $(REPO_ROOT)/cmds/ocm $(CREDS)
GEN := $(REPO_ROOT)/gen/$(NAME)
CHARTSRCS=$(shell find echoserver -type f)
.PHONY: ctf
ctf: $(GEN)/ctf
$(GEN)/ctf: $(GEN)/ca
@rm -f $(GEN)/ctf
$(OCM) -X keeplocalblob=true transfer ca $(GEN)/ca $(GEN)/ctf
touch $(GEN)/ctf
.PHONY: version
version:
@echo $(VERSION)
.PHONY: ca
ca: $(GEN)/ca
$(GEN)/ca: $(GEN)/.exists sources.yaml resources.yaml references.yaml $(CHARTSRCS) packagespec.yaml examples/* helmconfig.yaml
$(OCM) create ca -f $(COMPONENT) "$(VERSION)" --provider $(PROVIDER) --file $(GEN)/ca
$(OCM) add sources $(GEN)/ca VERSION="$(VERSION)" COMMIT="$(COMMIT)" IMAGE="$(IMAGE):$(VERSION)" sources.yaml
$(OCM) add resources $(GEN)/ca VERSION="$(VERSION)" COMMIT="$(COMMIT)" IMAGE="$(IMAGE):$(VERSION)" resources.yaml
$(OCM) add references $(GEN)/ca VERSION="$(VERSION)" COMMIT="$(COMMIT)" IMAGE="$(IMAGE):$(VERSION)" HELMINSTCOMP=$(HELMINSTCOMP) HELMINSTVERSION=$(HELMINSTVERSION) references.yaml
@touch $(GEN)/ca
.PHONY: eval-resources
eval-resources:
$(OCM) add resources --dry-run VERSION="$(VERSION)" COMMIT="$(COMMIT)" IMAGE="$(IMAGE):$(VERSION)" resources.yaml -O "$(GEN)/resources.yaml"
.PHONY: push
push: $(GEN)/ctf $(GEN)/push.$(NAME)
$(GEN)/push.$(NAME): $(GEN)/ctf
$(OCM) -X keeplocalblob=true transfer ctf -f $(GEN)/ctf $(OCMREPO)
@touch $(GEN)/push.$(NAME)
.PHONY: plain-push
plain-push: $(GEN)
$(OCM) -X keeplocalblob=true transfer ctf -f $(GEN)/ctf $(OCMREPO)
@touch $(GEN)/push.$(NAME)
.PHONY: transport
transport:
ifneq ($(TARGETREPO),)
$(OCM) -X keeplocalblob=true transfer component -Vc $(OCMREPO)//$(COMPONENT):$(VERSION) $(TARGETREPO)
endif
$(GEN)/.exists:
@mkdir -p $(GEN)
@touch $@
.PHONY: info
info:
@echo "ROOT: $(REPO_ROOT)"
@echo "VERSION: $(VERSION)"
@echo "COMMIT: $(COMMIT)"
@echo "CREDS: $(CREDS)"
@echo "version for helminstaller: $(HELMINSTVERSION)"
.PHONY: describe
describe: $(GEN)/ctf
$(OCM) get resources --lookup $(OCMREPO) -c -o treewide $(GEN)/ctf
.PHONY: descriptor
descriptor: $(GEN)/ctf
$(OCM) get component -S v3alpha1 -o yaml $(GEN)/ctf
.PHONY: clean
clean:
rm -rf $(GEN)