-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (36 loc) · 1.51 KB
/
Makefile
File metadata and controls
47 lines (36 loc) · 1.51 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
CATALOGS = catalog-bundle-object/rhacs-operator/catalog.json catalog-csv-metadata/rhacs-operator/catalog.json
# OPM v1.46.0 or newer is required to manipulate the files here.
OPM_VERSION = v1.48.0
MAKEFLAGS += "-j 2"
OPM = .bin/opm-$(OPM_VERSION)
GO := go
GENERATE_SCRIPT_FOLDER = ./cmd/generate-catalog/
.PHONY: valid-catalogs
valid-catalogs: $(CATALOGS) $(OPM)
$(OPM) validate catalog-bundle-object
$(OPM) validate catalog-csv-metadata
.PHONY: clean
clean:
rm -f catalog-template.yaml
rm -f $(CATALOGS)
rm -rf $$(dirname $(OPM))
catalog-bundle-object/rhacs-operator/catalog.json: catalog-template.yaml $(OPM)
mkdir -p "$$(dirname "$@")"
$(OPM) alpha render-template basic --migrate-level none $< > $@
catalog-csv-metadata/rhacs-operator/catalog.json: catalog-template.yaml $(OPM)
mkdir -p "$$(dirname "$@")"
$(OPM) alpha render-template basic --migrate-level bundle-object-to-csv-metadata $< > $@
# update template/catalog-template.yaml based on bundles.yaml file.
catalog-template.yaml: bundles.yaml $(wildcard $(GENERATE_SCRIPT_FOLDER)/*.go)
@$(GO) run $(GENERATE_SCRIPT_FOLDER)
go-test:
@$(GO) test -cover -v ./cmd/...
$(OPM):
mkdir -p "$$(dirname $@)"
os_name="$$(uname | tr '[:upper:]' '[:lower:]')"; \
arch="$$(go env GOARCH 2>/dev/null || echo amd64)"; \
for attempt in $$(seq 5); do \
if curl --silent --fail --location --output $@.tmp "https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)/$${os_name}-$${arch}-opm"; then break; fi; \
done
chmod +x $@.tmp
mv $@.tmp $@