forked from pmacct/pmacct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
293 lines (250 loc) · 14.2 KB
/
.travis.yml
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
language: C
services:
- docker
#Global variables; note this will not trigger job replication
env:
global:
- BUILD_DOCKER_FILE_UBUNTU_BIONIC=ci/Dockerfile-ubuntu-bionic-for-pmacct
- BUILD_DOCKER_TAG_UBUNTU_BIONIC=ci/ubuntu-bionic-for-pmacct
- BUILD_DOCKER_FILE_CENTOS_8=ci/Dockerfile-centos-8-for-pmacct
- BUILD_DOCKER_TAG_CENTOS_8=ci/centos8-for-pmacct
#Matrix of jobs
jobs:
include:
##Build stage
- docker_build_ubuntu:
name: Build docker image for Ubuntu Bionic
stage: docker
workspaces:
create:
name: docker_ubuntu_bionic
paths:
- /tmp/docker/
script:
- docker build -f $BUILD_DOCKER_FILE_UBUNTU_BIONIC -t $BUILD_DOCKER_TAG_UBUNTU_BIONIC .
- mkdir -p /tmp/docker/
- docker save -o /tmp/docker/registry.tar $BUILD_DOCKER_TAG_UBUNTU_BIONIC
- docker_build_centos:
name: Build docker image for Centos 8
stage: docker
workspaces:
create:
name: docker_centos_8
paths:
- /tmp/docker/
script:
- docker build -f $BUILD_DOCKER_FILE_CENTOS_8 -t $BUILD_DOCKER_TAG_CENTOS_8 .
- mkdir -p /tmp/docker/
- docker save -o /tmp/docker/registry.tar $BUILD_DOCKER_TAG_CENTOS_8
#Test
###Ubuntu Bionic
#Note to generate the names use this regex:
#%s/env: CONFIG_FLAGS="\(.*\)"/name: "docker: Ubuntu Bionic, (CONFIG_FLAGS=\1)"\r env: CONFIG_FLAGS="\1"/gc
###
### Note missing --enable-gnutls in Ubuntu Bionic (too old version shipped)
###
- &build_test_ubuntu_bionic
stage: build_test
workspaces:
use: docker_ubuntu_bionic
script:
- docker load -i /tmp/docker/registry.tar
- CONTAINER_ID=$(docker run --rm -it -d -v `pwd`:`pwd` -w `pwd` -e CONFIG_FLAGS $BUILD_DOCKER_TAG_UBUNTU_BIONIC:latest)
- echo "Launched container id:" $CONTAINER_ID
- docker exec -i $CONTAINER_ID ./ci/script.sh
- docker stop $CONTAINER_ID
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-nflog --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis"
env: CONFIG_FLAGS="--enable-debug --enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-nflog --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-nflog --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis"
env: CONFIG_FLAGS="--enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-nflog --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-zmq --enable-kafka"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-zmq --enable-kafka"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-jansson --enable-zmq --enable-kafka"
env: CONFIG_FLAGS="--enable-jansson --enable-zmq --enable-kafka"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-zmq"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-zmq"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-jansson --enable-zmq"
env: CONFIG_FLAGS="--enable-jansson --enable-zmq"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-kafka --enable-avro --enable-serdes"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-kafka --enable-avro --enable-serdes"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-jansson --enable-kafka --enable-avro --enable-serdes"
env: CONFIG_FLAGS="--enable-jansson --enable-kafka --enable-avro --enable-serdes"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-kafka"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-kafka"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-jansson --enable-kafka"
env: CONFIG_FLAGS="--enable-jansson --enable-kafka"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-zmq"
env: CONFIG_FLAGS="--enable-debug --enable-zmq"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-zmq"
env: CONFIG_FLAGS="--enable-zmq"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug --enable-jansson"
env: CONFIG_FLAGS="--enable-debug --enable-jansson"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-jansson"
env: CONFIG_FLAGS="--enable-jansson"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS=--enable-debug"
env: CONFIG_FLAGS="--enable-debug"
- <<: *build_test_ubuntu_bionic
name: "docker: Ubuntu Bionic, CONFIG_FLAGS="
env: CONFIG_FLAGS=""
##CENTOS 8
- &build_test_centos_8
stage: build_test
workspaces:
use: docker_centos_8
script:
- docker load -i /tmp/docker/registry.tar
- CONTAINER_ID=$(docker run --rm -it -d -v `pwd`:`pwd` -w `pwd` -e CONFIG_FLAGS $BUILD_DOCKER_TAG_CENTOS_8:latest)
- echo "Launched container id:" $CONTAINER_ID
- docker exec -i $CONTAINER_ID ./ci/script.sh
- docker stop $CONTAINER_ID
###
### Note missing libnetfilter_log in Centos8
###
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis --enable-gnutls"
env: CONFIG_FLAGS="--enable-debug --enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis --enable-gnutls"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis --enable-gnutls"
env: CONFIG_FLAGS="--enable-mysql --enable-pgsql --enable-sqlite3 --enable-kafka --enable-geoipv2 --enable-jansson --enable-rabbitmq --enable-ndpi --enable-zmq --enable-avro --enable-serdes --enable-redis --enable-gnutls"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-zmq --enable-kafka"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-zmq --enable-kafka"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-jansson --enable-zmq --enable-kafka"
env: CONFIG_FLAGS="--enable-jansson --enable-zmq --enable-kafka"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-zmq"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-zmq"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-jansson --enable-zmq"
env: CONFIG_FLAGS="--enable-jansson --enable-zmq"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-kafka --enable-avro --enable-serdes"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-kafka --enable-avro --enable-serdes"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-jansson --enable-kafka --enable-avro --enable-serdes"
env: CONFIG_FLAGS="--enable-jansson --enable-kafka --enable-avro --enable-serdes"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-jansson --enable-kafka"
env: CONFIG_FLAGS="--enable-debug --enable-jansson --enable-kafka"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-jansson --enable-kafka"
env: CONFIG_FLAGS="--enable-jansson --enable-kafka"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-zmq"
env: CONFIG_FLAGS="--enable-debug --enable-zmq"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-zmq"
env: CONFIG_FLAGS="--enable-zmq"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug --enable-jansson"
env: CONFIG_FLAGS="--enable-debug --enable-jansson"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-jansson"
env: CONFIG_FLAGS="--enable-jansson"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS=--enable-debug"
env: CONFIG_FLAGS="--enable-debug"
- <<: *build_test_centos_8
name: "docker: Centos 8, CONFIG_FLAGS="
env: CONFIG_FLAGS=""
## User docker containers
- docker_hub_base:
stage: docker_hub
name: "docker_hub: base container"
env: PMACCT_VERSION=$(git describe --abbrev=0 --match="v*")
if: type NOT IN (pull_request)
script:
- echo "Building the base container..."
- docker build -f docker/base/Dockerfile -t base:_build .
- echo "Building daemon containers..."
- docker build -f docker/pmacctd/Dockerfile -t pmacctd:_build .
- docker build -f docker/nfacctd/Dockerfile -t nfacctd:_build .
- docker build -f docker/sfacctd/Dockerfile -t sfacctd:_build .
- docker build -f docker/uacctd/Dockerfile -t uacctd:_build .
- docker build -f docker/pmbgpd/Dockerfile -t pmbgpd:_build .
- docker build -f docker/pmbmpd/Dockerfile -t pmbmpd:_build .
- docker build -f docker/pmtelemetryd/Dockerfile -t pmtelemetryd:_build .
- echo "Uploading to dockerhub ...";
- echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin;
#Always push bleeding-edge when pushed to master
- GIT_IS_BLEEDING_EDGE=$( (git branch --contains HEAD | grep master ) || echo "")
- |
if [ "$GIT_IS_BLEEDING_EDGE" != "" ]; then
echo "Uploading 'bleeding-edge' tag for `git describe`...";
docker tag base:_build ${DOCKER_USERNAME}/base:bleeding-edge;
docker push ${DOCKER_USERNAME}/base:bleeding-edge;
docker tag pmacctd:_build ${DOCKER_USERNAME}/pmacctd:bleeding-edge;
docker push ${DOCKER_USERNAME}/pmacctd:bleeding-edge;
docker tag nfacctd:_build ${DOCKER_USERNAME}/nfacctd:bleeding-edge;
docker push ${DOCKER_USERNAME}/nfacctd:bleeding-edge;
docker tag sfacctd:_build ${DOCKER_USERNAME}/sfacctd:bleeding-edge;
docker push ${DOCKER_USERNAME}/sfacctd:bleeding-edge;
docker tag uacctd:_build ${DOCKER_USERNAME}/uacctd:bleeding-edge;
docker push ${DOCKER_USERNAME}/uacctd:bleeding-edge;
docker tag pmbgpd:_build ${DOCKER_USERNAME}/pmbgpd:bleeding-edge;
docker push ${DOCKER_USERNAME}/pmbgpd:bleeding-edge;
docker tag pmbmpd:_build ${DOCKER_USERNAME}/pmbmpd:bleeding-edge;
docker push ${DOCKER_USERNAME}/pmbmpd:bleeding-edge;
docker tag pmtelemetryd:_build ${DOCKER_USERNAME}/pmtelemetryd:bleeding-edge;
docker push ${DOCKER_USERNAME}/pmtelemetryd:bleeding-edge;
fi
#Upload vX.Y.Z only of it's a release commit
- GIT_RELEASE_TAG=$(git describe --exact-match --match "v*" || echo "")
- |
if [ "$GIT_RELEASE_TAG" != "" ]; then
echo "Uploading '$PMACCT_VERSION' tag for `git describe`...";
docker tag base:_build ${DOCKER_USERNAME}/base:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/base:${PMACCT_VERSION};
docker tag pmacctd:_build ${DOCKER_USERNAME}/pmacctd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/pmacctd:${PMACCT_VERSION};
docker tag nfacctd:_build ${DOCKER_USERNAME}/nfacctd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/nfacctd:${PMACCT_VERSION};
docker tag sfacctd:_build ${DOCKER_USERNAME}/sfacctd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/sfacctd:${PMACCT_VERSION};
docker tag uacctd:_build ${DOCKER_USERNAME}/uacctd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/uacctd:${PMACCT_VERSION};
docker tag pmbgpd:_build ${DOCKER_USERNAME}/pmbgpd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/pmbgpd:${PMACCT_VERSION};
docker tag pmbmpd:_build ${DOCKER_USERNAME}/pmbmpd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/pmbmpd:${PMACCT_VERSION};
docker tag pmtelemetryd:_build ${DOCKER_USERNAME}/pmtelemetryd:${PMACCT_VERSION};
docker push ${DOCKER_USERNAME}/pmtelemetryd:${PMACCT_VERSION};
fi
#Upload "latest" if the release version is the highest
- |
if [ "$GIT_RELEASE_TAG" != "" ]; then
GIT_LAST_TAG=$(git tag --sort=v:refname | tail -n 1);
if [ "$GIT_RELEASE_TAG" == "$GIT_LAST_TAG" ]; then
echo "Uploading 'latest' tag for `git describe`...";
docker tag base:_build ${DOCKER_USERNAME}/base:latest;
docker push ${DOCKER_USERNAME}/base:latest;
docker tag pmacctd:_build ${DOCKER_USERNAME}/pmacctd:latest;
docker push ${DOCKER_USERNAME}/pmacctd:latest;
docker tag nfacctd:_build ${DOCKER_USERNAME}/nfacctd:latest;
docker push ${DOCKER_USERNAME}/nfacctd:latest;
docker tag sfacctd:_build ${DOCKER_USERNAME}/sfacctd:latest;
docker push ${DOCKER_USERNAME}/sfacctd:latest;
docker tag uacctd:_build ${DOCKER_USERNAME}/uacctd:latest;
docker push ${DOCKER_USERNAME}/uacctd:latest;
docker tag pmbgpd:_build ${DOCKER_USERNAME}/pmbgpd:latest;
docker push ${DOCKER_USERNAME}/pmbgpd:latest;
docker tag pmbmpd:_build ${DOCKER_USERNAME}/pmbmpd:latest;
docker push ${DOCKER_USERNAME}/pmbmpd:latest;
docker tag pmtelemetryd:_build ${DOCKER_USERNAME}/pmtelemetryd:latest;
docker push ${DOCKER_USERNAME}/pmtelemetryd:latest;
fi
fi