forked from lest/prometheus-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
123 lines (106 loc) · 3.23 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
MANUAL = jmx_exporter
AUTO_GENERATED = alertmanager \
node_exporter \
blackbox_exporter \
pushgateway \
mysqld_exporter \
elasticsearch_exporter \
postgres_exporter \
pgbouncer_exporter \
redis_exporter \
haproxy_exporter \
kafka_exporter \
mongodb_exporter \
statsd_exporter \
memcached_exporter \
consul_exporter \
smokeping_prober \
apache_exporter \
process_exporter \
ssl_exporter \
artifactory_exporter \
sql_exporter \
cadvisor \
bird_exporter \
promxy
.PHONY: $(MANUAL) $(AUTO_GENERATED)
INTERACTIVE:=$(shell [ -t 0 ] && echo 1)
ifdef INTERACTIVE
DOCKER_FLAGS = -it --rm
else
DOCKER_FLAGS = --rm
endif
all: auto manual
manual: $(MANUAL)
auto: $(AUTO_GENERATED)
manual9: $(addprefix build9-,$(MANUAL))
$(addprefix build9-,$(MANUAL)):
$(eval PACKAGE=$(subst build9-,,$@))
[ -d ${PWD}/_dist9 ] || mkdir ${PWD}/_dist9
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run ${DOCKER_FLAGS} \
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
-v ${PWD}/_dist9:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/_dist9:/rpmbuild/RPMS/noarch \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/yashumitsu/prometheus-rpm-builder-almalinux9 \
build-spec SOURCES/${PACKAGE}.spec
# Test the install
[ -d ${PWD}/_dist9 ] || mkdir ${PWD}/_dist9
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run --privileged ${DOCKER_FLAGS} \
-v ${PWD}/_dist9:/var/tmp/ \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/yashumitsu/prometheus-rpm-builder-almalinux9 \
/bin/bash -c '/usr/bin/dnf install --verbose -y /var/tmp/${PACKAGE}*.rpm'
auto9: $(addprefix build9-,$(AUTO_GENERATED))
$(addprefix build9-,$(AUTO_GENERATED)):
$(eval PACKAGE=$(subst build9-,,$@))
python3 ./generate.py --templates ${PACKAGE}
[ -d ${PWD}/_dist9 ] || mkdir ${PWD}/_dist9
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run ${DOCKER_FLAGS} \
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
-v ${PWD}/_dist9:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/_dist9:/rpmbuild/RPMS/noarch \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/yashumitsu/prometheus-rpm-builder-almalinux9 \
build-spec SOURCES/autogen_${PACKAGE}.spec
# Test the install
[ -d ${PWD}/_dist9 ] || mkdir ${PWD}/_dist9
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run --privileged ${DOCKER_FLAGS} \
-v ${PWD}/_dist9:/var/tmp/ \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/yashumitsu/prometheus-rpm-builder-almalinux9 \
/bin/bash -c '/usr/bin/dnf install --verbose -y /var/tmp/${PACKAGE}*.rpm'
sign9:
docker run --rm \
-v ${PWD}/_dist9:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/bin:/rpmbuild/bin \
-v ${PWD}/RPM-GPG-KEY-prometheus-rpm:/rpmbuild/RPM-GPG-KEY-prometheus-rpm \
-v ${PWD}/secret.asc:/rpmbuild/secret.asc \
-v ${PWD}/.passphrase:/rpmbuild/.passphrase \
ghcr.io/yashumitsu/prometheus-rpm-builder-almalinux9 \
bin/sign
$(foreach \
PACKAGE,$(MANUAL),$(eval \
${PACKAGE}: \
$(addprefix build9-,${PACKAGE}) \
) \
)
$(foreach \
PACKAGE,$(AUTO_GENERATED),$(eval \
${PACKAGE}: \
$(addprefix build9-,${PACKAGE}) \
) \
)
sign: sign9
publish9: sign9
package_cloud push --skip-errors yashumitsu/prometheus-rpm/el/9 _dist9/*.rpm
publish: publish9
clean:
rm -rf _cache_dnf _cache_yum _dist*
rm -f **/*.tar.gz
rm -f **/*.jar
rm -f **/autogen_*{default,init,unit,spec}