-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
152 lines (123 loc) · 6.25 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
CONTAINER_MANAGER ?= podman
# Helpers
TOOLS_DIR := tools
include tools/tools.mk
## Functions
# Set image and version on the task
# 1 image
# 2 version
# 3 context
define tkn_template
sed -e 's%cimage%$(1)%g' -e 's%cversion%$(2)%g' $(3)/tkn/tpl/$(4).tpl.yaml > $(3)/tkn/$(4).yaml
endef
#### snc-runner ####
.PHONY: snc-runner-oci-build snc-runner-oci-save snc-runner-oci-load snc-runner-oci-push snc-runner-tkn-create snc-runner-tkn-push
# Variables
SNC_RUNNER ?= $(shell sed -n 1p snc-runner/release-info)
SNC_RUNNER_V ?= v$(shell sed -n 2p snc-runner/release-info)
SNC_RUNNER_SAVE ?= snc-runner
snc-runner-oci-build: CONTEXT=snc-runner/oci
snc-runner-oci-build: MANIFEST=$(SNC_RUNNER):$(SNC_RUNNER_V)
snc-runner-oci-build:
${CONTAINER_MANAGER} build -t $(MANIFEST) -f $(CONTEXT)/Containerfile $(CONTEXT)
snc-runner-oci-save:
${CONTAINER_MANAGER} save -o $(SNC_RUNNER_SAVE).tar $(SNC_RUNNER):$(SNC_RUNNER_V)
snc-runner-oci-load:
${CONTAINER_MANAGER} load -i $(SNC_RUNNER_SAVE).tar
snc-runner-oci-push:
ifndef IMAGE
IMAGE = $(SNC_RUNNER):$(SNC_RUNNER_V)
endif
${CONTAINER_MANAGER} push $(IMAGE)
snc-runner-tkn-create:
$(call tkn_template,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner,task)
$(call tkn_template,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner,pipeline)
snc-runner-tkn-push: install-out-of-tree-tools
ifndef IMAGE
IMAGE = $(SNC_RUNNER):$(SNC_RUNNER_V)
endif
$(TOOLS_BINDIR)/tkn bundle push $(IMAGE)-tkn \
-f snc-runner/tkn/task.yaml \
-f snc-runner/tkn/pipeline.yaml
#### crc-builder ####
.PHONY: crc-builder-oci-build crc-builder-oci-save crc-builder-oci-load crc-builder-oci-push crc-builder-tkn-create crc-builder-tkn-push
# Registries and versions
CRC_BUILDER ?= $(shell sed -n 1p crc-builder/release-info)
CRC_BUILDER_V ?= v$(shell sed -n 2p crc-builder/release-info)
CRC_BUILDER_SAVE ?= crc-builder
crc-builder-oci-build: CONTEXT=crc-builder/oci
crc-builder-oci-build: MANIFEST=$(CRC_BUILDER):$(CRC_BUILDER_V)
crc-builder-oci-build:
${CONTAINER_MANAGER} build --platform linux/arm64 --manifest $(MANIFEST)-linux-arm64 -f $(CONTEXT)/Containerfile.linux $(CONTEXT)
${CONTAINER_MANAGER} build --platform linux/amd64 --manifest $(MANIFEST)-linux-amd64 -f $(CONTEXT)/Containerfile.linux $(CONTEXT)
${CONTAINER_MANAGER} build -t $(MANIFEST)-windows -f $(CONTEXT)/Containerfile.non-linux --build-arg=OS=windows $(CONTEXT)
${CONTAINER_MANAGER} build -t $(MANIFEST)-darwin -f $(CONTEXT)/Containerfile.non-linux --build-arg=OS=darwin $(CONTEXT)
crc-builder-oci-save: MANIFEST=$(CRC_BUILDER):$(CRC_BUILDER_V)
crc-builder-oci-save: ARM64D=$(shell ${CONTAINER_MANAGER} manifest inspect ${MANIFEST}-linux-arm64 | jq '.manifests[0].digest')
crc-builder-oci-save:
${CONTAINER_MANAGER} manifest annotate --arch amd64 $(MANIFEST)-linux-arm64 $(ARM64D)
${CONTAINER_MANAGER} save -m -o $(CRC_BUILDER_SAVE)-linux-amd64.tar $(MANIFEST)-linux-amd64
${CONTAINER_MANAGER} save -m -o $(CRC_BUILDER_SAVE)-linux-arm64.tar $(MANIFEST)-linux-arm64
${CONTAINER_MANAGER} save -o $(CRC_BUILDER_SAVE)-windows.tar $(MANIFEST)-windows
${CONTAINER_MANAGER} save -o $(CRC_BUILDER_SAVE)-darwin.tar $(MANIFEST)-darwin
crc-builder-oci-load:
${CONTAINER_MANAGER} load -i $(CRC_BUILDER_SAVE)-linux-arm64.tar
${CONTAINER_MANAGER} load -i $(CRC_BUILDER_SAVE)-linux-amd64.tar
${CONTAINER_MANAGER} load -i $(CRC_BUILDER_SAVE)-windows.tar
${CONTAINER_MANAGER} load -i $(CRC_BUILDER_SAVE)-darwin.tar
crc-builder-oci-push: MANIFEST=$(CRC_BUILDER):$(CRC_BUILDER_V)
crc-builder-oci-push:
${CONTAINER_MANAGER} push $(MANIFEST)-linux-arm64
${CONTAINER_MANAGER} push $(MANIFEST)-linux-amd64
${CONTAINER_MANAGER} manifest create $(MANIFEST)-linux
${CONTAINER_MANAGER} manifest add $(MANIFEST)-linux docker://$(MANIFEST)-linux-arm64
${CONTAINER_MANAGER} manifest add $(MANIFEST)-linux docker://$(MANIFEST)-linux-amd64
${CONTAINER_MANAGER} manifest push --all $(MANIFEST)-linux
${CONTAINER_MANAGER} push $(MANIFEST)-windows
${CONTAINER_MANAGER} push $(MANIFEST)-darwin
crc-builder-tkn-create:
$(call tkn_template,$(CRC_BUILDER),$(CRC_BUILDER_V),crc-builder,crc-builder-installer)
$(call tkn_template,$(CRC_BUILDER),$(CRC_BUILDER_V),crc-builder,crc-builder)
$(call tkn_template,$(CRC_BUILDER),$(CRC_BUILDER_V),crc-builder,crc-builder-arm64)
crc-builder-tkn-push: install-out-of-tree-tools
ifndef IMAGE
IMAGE = $(CRC_BUILDER):$(CRC_BUILDER_V)
endif
$(TOOLS_BINDIR)/tkn bundle push $(IMAGE)-tkn \
-f crc-builder/tkn/crc-builder-installer.yaml \
-f crc-builder/tkn/crc-builder.yaml \
-f crc-builder/tkn/crc-builder-arm64.yaml
#### crc-support ####
.PHONY: crc-support-oci-build crc-support-oci-save crc-support-oci-load crc-support-oci-push crc-support-tkn-create crc-support-tkn-push
# Registries and versions
CRC_SUPPORT ?= $(shell sed -n 1p crc-support/release-info)
CRC_SUPPORT_V ?= v$(shell sed -n 2p crc-support/release-info)
CRC_SUPPORT_SAVE ?= crc-support
crc-support-oci-build: CONTEXT=crc-support/oci
crc-support-oci-build: MANIFEST=$(CRC_SUPPORT):$(CRC_SUPPORT_V)
crc-support-oci-build:
${CONTAINER_MANAGER} build -t $(MANIFEST)-linux -f $(CONTEXT)/Containerfile --build-arg=OS=linux $(CONTEXT)
${CONTAINER_MANAGER} build -t $(MANIFEST)-windows -f $(CONTEXT)/Containerfile --build-arg=OS=windows $(CONTEXT)
${CONTAINER_MANAGER} build -t $(MANIFEST)-darwin -f $(CONTEXT)/Containerfile --build-arg=OS=darwin $(CONTEXT)
crc-support-oci-save: MANIFEST=$(CRC_SUPPORT):$(CRC_SUPPORT_V)
crc-support-oci-save:
${CONTAINER_MANAGER} save -o $(CRC_SUPPORT_SAVE)-linux.tar $(MANIFEST)-linux
${CONTAINER_MANAGER} save -o $(CRC_SUPPORT_SAVE)-windows.tar $(MANIFEST)-windows
${CONTAINER_MANAGER} save -o $(CRC_SUPPORT_SAVE)-darwin.tar $(MANIFEST)-darwin
crc-support-oci-load:
${CONTAINER_MANAGER} load -i $(CRC_SUPPORT_SAVE)-linux.tar
${CONTAINER_MANAGER} load -i $(CRC_SUPPORT_SAVE)-windows.tar
${CONTAINER_MANAGER} load -i $(CRC_SUPPORT_SAVE)-darwin.tar
crc-support-oci-push: MANIFEST=$(CRC_SUPPORT):$(CRC_SUPPORT_V)
crc-support-oci-push:
${CONTAINER_MANAGER} push $(MANIFEST)-linux
${CONTAINER_MANAGER} push $(MANIFEST)-windows
${CONTAINER_MANAGER} push $(MANIFEST)-darwin
crc-support-tkn-create:
$(call tkn_template,$(CRC_SUPPORT),$(CRC_SUPPORT_V),crc-support,task)
crc-support-tkn-push: install-out-of-tree-tools
ifndef IMAGE
IMAGE = $(CRC_SUPPORT):$(CRC_SUPPORT_V)
endif
$(TOOLS_BINDIR)/tkn bundle push $(IMAGE)-tkn \
-f crc-support/tkn/task.yaml