@@ -31,8 +31,8 @@ SCANNER_DATE := `date +%Y-%m-%d`
3131SCANNER_DATE_YEST := ` TZ=GMT+24 +%Y:%m:%d `
3232SCANNER_VERSION := v8
3333SCANNER_LOCALIP := $(shell ifconfig | grep -Eo 'inet (addr:) ?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | awk '{print $1}' | head -n 1)
34- SCANNER_IMAGES_TO_SCAN := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8
35- CONTAINERS_TO_SAVE := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8
34+ SCANNER_IMAGES_TO_SCAN := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
35+ CONTAINERS_TO_SAVE := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
3636ifeq ($(shell uname) , Linux)
3737 SCANNER_FILE = clair-scanner_linux_amd64
3838else ifeq ($(shell uname), Darwin)
4444
4545.PHONY : tests interactive_tutorials
4646
47- all : splunk uf
47+ all : splunk uf splunk-py23 uf-py23
4848
4949ansible :
5050 @if [ -d " splunk-ansible" ]; then \
@@ -225,6 +225,61 @@ uf-windows-2016: base-windows-2016 ansible
225225 --build-arg SPLUNK_BUILD_URL=${UF_WIN_BUILD_URL} \
226226 -t uf-windows-2016:${IMAGE_VERSION} .
227227
228+
229+ # #### Python 3 support #####
230+ splunk-py23 : splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8
231+
232+ splunk-py23-debian-9 : splunk-debian-9
233+ docker build ${DOCKER_BUILD_FLAGS} \
234+ -f py23-image/debian-9/Dockerfile \
235+ --build-arg SPLUNK_PRODUCT=splunk \
236+ -t splunk-py23-debian-9:${IMAGE_VERSION} .
237+
238+ splunk-py23-debian-10 : splunk-debian-10
239+ docker build ${DOCKER_BUILD_FLAGS} \
240+ -f py23-image/debian-10/Dockerfile \
241+ --build-arg SPLUNK_PRODUCT=splunk \
242+ -t splunk-py23-debian-10:${IMAGE_VERSION} .
243+
244+ splunk-py23-centos-7 : splunk-centos-7
245+ docker build ${DOCKER_BUILD_FLAGS} \
246+ -f py23-image/centos-7/Dockerfile \
247+ --build-arg SPLUNK_PRODUCT=splunk \
248+ -t splunk-py23-centos-7:${IMAGE_VERSION} .
249+
250+ splunk-py23-redhat-8 : splunk-redhat-8
251+ docker build ${DOCKER_BUILD_FLAGS} \
252+ -f py23-image/redhat-8/Dockerfile \
253+ --build-arg SPLUNK_PRODUCT=splunk \
254+ -t splunk-py23-redhat-8:${IMAGE_VERSION} .
255+
256+ uf-py23 : uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
257+
258+ uf-py23-debian-9 : uf-debian-9
259+ docker build ${DOCKER_BUILD_FLAGS} \
260+ -f py23-image/debian-9/Dockerfile \
261+ --build-arg SPLUNK_PRODUCT=uf \
262+ -t uf-py23-debian-9:${IMAGE_VERSION} .
263+
264+ uf-py23-debian-10 : uf-debian-10
265+ docker build ${DOCKER_BUILD_FLAGS} \
266+ -f py23-image/debian-10/Dockerfile \
267+ --build-arg SPLUNK_PRODUCT=uf \
268+ -t uf-py23-debian-10:${IMAGE_VERSION} .
269+
270+ uf-py23-centos-7 : uf-centos-7
271+ docker build ${DOCKER_BUILD_FLAGS} \
272+ -f py23-image/centos-7/Dockerfile \
273+ --build-arg SPLUNK_PRODUCT=uf \
274+ -t uf-py23-centos-7:${IMAGE_VERSION} .
275+
276+ uf-py23-redhat-8 : uf-redhat-8
277+ docker build ${DOCKER_BUILD_FLAGS} \
278+ -f py23-image/redhat-8/Dockerfile \
279+ --build-arg SPLUNK_PRODUCT=uf \
280+ -t uf-py23-redhat-8:${IMAGE_VERSION} .
281+
282+
228283# #### Tests #####
229284sample-compose-up : sample-compose-down
230285 docker-compose -f test_scenarios/${SPLUNK_COMPOSE} up -d
@@ -248,14 +303,16 @@ run_tests_centos7:
248303
249304run_tests_redhat8 :
250305 @echo ' Running the super awesome tests; RedHat 8'
251- pytest -sv tests/test_redhat_8 .py --junitxml test-results/redhat8-result/testresults_redhat8.xml
306+ pytest -sv tests/test_docker_splunk .py --platform redhat-8 --junitxml test-results/redhat8-result/testresults_redhat8.xml
252307
253308test_setup :
254309 @echo ' Install test requirements'
255310 pip install --upgrade pip
256311 pip install -r $(shell pwd) /tests/requirements.txt --upgrade
257312 mkdir test-results/centos7-result || true
258313 mkdir test-results/debian9-result || true
314+ mkdir test-results/debian10-result || true
315+ mkdir test-results/redhat8-result || true
259316
260317run_tests_debian9 :
261318 @echo ' Running the super awesome tests; Debian 9'
@@ -270,6 +327,91 @@ save_containers:
270327 mkdir test-results/saved_images || true
271328 $(foreach image,${CONTAINERS_TO_SAVE}, echo "Currently saving: ${image}"; docker save ${image} --output test-results/saved_images/${image}.tar; echo "Compressing: ${image}.tar"; gzip test-results/saved_images/${image}.tar; )
272329
330+ test_python3_all : test_splunk_python3_all test_uf_python3_all
331+
332+ test_splunk_python3_all : test_splunk_centos7_python3 test_splunk_redhat8_python3 test_splunk_debian9_python3 test_splunk_debian10_python3
333+
334+ test_uf_python3_all : test_uf_centos7_python3 test_uf_redhat8_python3 test_uf_debian9_python3 test_uf_debian10_python3
335+
336+ test_splunk_centos7_python3 :
337+ $(call test_python3_installation,splunk-py23-centos-7)
338+
339+ test_splunk_redhat8_python3 :
340+ $(call test_python3_installation,splunk-py23-redhat-8)
341+
342+ test_splunk_debian9_python3 :
343+ $(call test_python3_installation,splunk-py23-debian-9)
344+
345+ test_splunk_debian10_python3 :
346+ $(call test_python3_installation,splunk-py23-debian-10)
347+
348+ test_uf_centos7_python3 :
349+ $(call test_python3_installation,uf-py23-centos-7)
350+
351+ test_uf_redhat8_python3 :
352+ $(call test_python3_installation,uf-py23-redhat-8)
353+
354+ test_uf_debian9_python3 :
355+ $(call test_python3_installation,uf-py23-debian-9)
356+
357+ test_uf_debian10_python3 :
358+ $(call test_python3_installation,uf-py23-debian-10)
359+
360+ define test_python3_installation
361+ docker run -d --rm --name $1 -it $1 bash
362+ docker exec -it $1 bash -c 'if [[ $$(python3 -V ) =~ "Python 3" ]] ; then echo "$$(python3 -V ) installed" ; else echo "No Python3 installation found" ; docker kill $1 ; exit 1 ; fi'
363+ docker kill $1
364+ endef
365+
366+ test_python2_all : test_splunk_python2_all test_uf_python2_all
367+
368+ test_splunk_python2_all : test_splunk_centos7_python2 test_splunk_redhat8_python2 test_splunk_debian9_python2 test_splunk_debian10_python2
369+
370+ test_uf_python2_all : test_uf_centos7_python2 test_uf_redhat8_python2 test_uf_debian9_python2 test_uf_debian10_python2
371+
372+ test_splunk_centos7_python2 :
373+ $(call test_python2_installation,splunk-py23-centos-7)
374+
375+ test_splunk_redhat8_python2 :
376+ $(call test_python2_installation,splunk-py23-redhat-8)
377+
378+ test_splunk_debian9_python2 :
379+ $(call test_python2_installation,splunk-py23-debian-9)
380+
381+ test_splunk_debian10_python2 :
382+ $(call test_python2_installation,splunk-py23-debian-10)
383+
384+ test_uf_centos7_python2 :
385+ $(call test_python2_installation,uf-py23-centos-7)
386+
387+ test_uf_redhat8_python2 :
388+ $(call test_python2_installation,uf-py23-redhat-8)
389+
390+ test_uf_debian9_python2 :
391+ $(call test_python2_installation,uf-py23-debian-9)
392+
393+ test_uf_debian10_python2 :
394+ $(call test_python2_installation,uf-py23-debian-10)
395+
396+ # python2 version print to stderr, hence the 2>&1
397+ define test_python2_installation
398+ docker run -d --rm --name $1 -it $1 bash
399+ docker exec -it $1 bash -c 'if [[ $$(python -V 2>&1 ) =~ "Python 2" ]] ; then echo "$$(python -V 2>&1 ) is the default python" ; else echo "Python is not default to python2" ; docker kill $1 ; exit 1 ; fi'
400+ docker kill $1
401+ endef
402+
403+ test_debian9_image_size :
404+ $(call test_image_size,splunk-debian-9)
405+
406+ define test_image_size
407+ docker pull splunk/splunk:edge
408+ CUR_SIZE=$$(docker image inspect $1:latest --format='{{.Size}}' ) ; \
409+ EDGE_SIZE=$$(docker image inspect splunk/splunk:edge --format='{{.Size}}' ) ; \
410+ echo "current $1 image size = "$$CUR_SIZE ; \
411+ echo "edge image size = "$$EDGE_SIZE ; \
412+ if [[ $$CUR_SIZE -gt $$EDGE_SIZE*102/100 ]] ; then echo "current image size is 2% more than edge image" ; exit 1 ; fi
413+ endef
414+
273415setup_clair_scanner :
274416 mkdir clair-scanner-logs
275417 mkdir test-results/cucumber
0 commit comments