forked from lest/prometheus-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
203 lines (180 loc) · 5.64 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
MANUAL = prometheus2 \
alertmanager \
thanos \
elasticsearch_exporter \
jmx_exporter \
rabbitmq_exporter \
ping_exporter \
couchbase_exporter \
mtail \
AUTO_GENERATED = node_exporter \
blackbox_exporter \
snmp_exporter \
pushgateway \
mysqld_exporter \
postgres_exporter \
redis_exporter \
haproxy_exporter \
kafka_exporter \
nginx_exporter \
bind_exporter \
json_exporter \
keepalived_exporter \
jolokia_exporter \
frr_exporter \
domain_exporter \
mongodb_exporter \
graphite_exporter \
statsd_exporter \
collectd_exporter \
memcached_exporter \
consul_exporter \
smokeping_prober \
iperf3_exporter \
apache_exporter \
influxdb_exporter \
exporter_exporter \
junos_exporter \
openstack_exporter \
process_exporter \
ssl_exporter \
sachet \
jiralert \
ebpf_exporter \
karma \
ctdb_exporter
.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)
manual8: $(addprefix build8-,$(MANUAL))
manual7: $(addprefix build7-,$(MANUAL))
$(addprefix build8-,$(MANUAL)):
$(eval PACKAGE=$(subst build8-,,$@))
[ -d ${PWD}/_dist8 ] || mkdir ${PWD}/_dist8
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run ${DOCKER_FLAGS} \
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
-v ${PWD}/_dist8:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/_dist8:/rpmbuild/RPMS/noarch \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/lest/centos-rpm-builder:8 \
build-spec SOURCES/${PACKAGE}.spec
# Test the install
[ -d ${PWD}/_dist8 ] || mkdir ${PWD}/_dist8
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run --privileged ${DOCKER_FLAGS} \
-v ${PWD}/_dist8:/var/tmp/ \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/lest/centos-rpm-builder:8 \
/bin/bash -c '/usr/bin/dnf install --verbose -y /var/tmp/${PACKAGE}*.rpm'
$(addprefix build7-,$(MANUAL)):
$(eval PACKAGE=$(subst build7-,,$@))
[ -d ${PWD}/_dist7 ] || mkdir ${PWD}/_dist7
[ -d ${PWD}/_cache_yum ] || mkdir ${PWD}/_cache_yum
docker run ${DOCKER_FLAGS} \
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
-v ${PWD}/_dist7:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/_dist7:/rpmbuild/RPMS/noarch \
-v ${PWD}/_cache_yum:/var/cache/yum \
ghcr.io/lest/centos-rpm-builder:7 \
build-spec SOURCES/${PACKAGE}.spec
# Test the install
[ -d ${PWD}/_dist7 ] || mkdir ${PWD}/_dist7
[ -d ${PWD}/_cache_yum ] || mkdir ${PWD}/_cache_yum
docker run --privileged ${DOCKER_FLAGS} \
-v ${PWD}/_dist7:/var/tmp/ \
-v ${PWD}/_cache_yum:/var/cache/yum \
ghcr.io/lest/centos-rpm-builder:7 \
/bin/bash -c '/usr/bin/yum install --verbose -y /var/tmp/${PACKAGE}*.rpm'
auto8: $(addprefix build8-,$(AUTO_GENERATED))
auto7: $(addprefix build7-,$(AUTO_GENERATED))
$(addprefix build8-,$(AUTO_GENERATED)):
$(eval PACKAGE=$(subst build8-,,$@))
python3 ./generate.py --templates ${PACKAGE}
[ -d ${PWD}/_dist8 ] || mkdir ${PWD}/_dist8
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run ${DOCKER_FLAGS} \
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
-v ${PWD}/_dist8:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/_dist8:/rpmbuild/RPMS/noarch \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/lest/centos-rpm-builder:8 \
build-spec SOURCES/autogen_${PACKAGE}.spec
# Test the install
[ -d ${PWD}/_dist8 ] || mkdir ${PWD}/_dist8
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
docker run --privileged ${DOCKER_FLAGS} \
-v ${PWD}/_dist8:/var/tmp/ \
-v ${PWD}/_cache_dnf:/var/cache/dnf \
ghcr.io/lest/centos-rpm-builder:8 \
/bin/bash -c '/usr/bin/dnf install --verbose -y /var/tmp/${PACKAGE}*.rpm'
sign8:
docker run --rm \
-v ${PWD}/_dist8:/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/lest/centos-rpm-builder:8 \
bin/sign
$(addprefix build7-,$(AUTO_GENERATED)):
$(eval PACKAGE=$(subst build7-,,$@))
python3 ./generate.py --templates ${PACKAGE}
[ -d ${PWD}/_dist7 ] || mkdir ${PWD}/_dist7
[ -d ${PWD}/_cache_yum ] || mkdir ${PWD}/_cache_yum
docker run ${DOCKER_FLAGS} \
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
-v ${PWD}/_dist7:/rpmbuild/RPMS/x86_64 \
-v ${PWD}/_dist7:/rpmbuild/RPMS/noarch \
-v ${PWD}/_cache_yum:/var/cache/yum \
ghcr.io/lest/centos-rpm-builder:7 \
build-spec SOURCES/autogen_${PACKAGE}.spec
# Test the install
[ -d ${PWD}/_dist7 ] || mkdir ${PWD}/_dist7
[ -d ${PWD}/_cache_yum ] || mkdir ${PWD}/_cache_yum
docker run --privileged ${DOCKER_FLAGS} \
-v ${PWD}/_dist7:/var/tmp/ \
-v ${PWD}/_cache_yum:/var/cache/yum \
ghcr.io/lest/centos-rpm-builder:7 \
/bin/bash -c '/usr/bin/yum install --verbose -y /var/tmp/${PACKAGE}*.rpm'
sign7:
docker run --rm \
-v ${PWD}/_dist7:/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/lest/centos-rpm-builder:7 \
bin/sign
$(foreach \
PACKAGE,$(MANUAL),$(eval \
${PACKAGE}: \
$(addprefix build8-,${PACKAGE}) \
$(addprefix build7-,${PACKAGE}) \
) \
)
$(foreach \
PACKAGE,$(AUTO_GENERATED),$(eval \
${PACKAGE}: \
$(addprefix build8-,${PACKAGE}) \
$(addprefix build7-,${PACKAGE}) \
) \
)
sign: sign8 sign7
publish8: sign8
package_cloud push --skip-errors prometheus-rpm/release/el/8 _dist8/*.rpm
publish7: sign7
package_cloud push --skip-errors prometheus-rpm/release/el/7 _dist7/*.rpm
publish: publish8 publish7
clean:
rm -rf _cache_dnf _cache_yum _dist*
rm -f **/*.tar.gz
rm -f **/*.jar
rm -f **/autogen_*{default,init,unit,spec}