Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d5e861e
python3 all platform. py3 tests
hendolim Aug 5, 2019
b2ef63e
py3 test ci
hendolim Aug 5, 2019
f07dc7a
indent
hendolim Aug 6, 2019
14ddbe5
install pkgs through dpkg or the likes
hendolim Aug 6, 2019
a493c3a
ci python3 image
hendolim Aug 6, 2019
154b215
docker python3 image. more test
hendolim Aug 6, 2019
8289f3a
have to use machine image
hendolim Aug 6, 2019
e101daf
trigger ci
hendolim Aug 6, 2019
fa09489
pip3 install
hendolim Aug 6, 2019
dab820c
try python3.5
hendolim Aug 6, 2019
8d5f224
pip3 installation location varies. Just run it as a script
hendolim Aug 6, 2019
0677632
py3first to fail fast
hendolim Aug 6, 2019
5bdbb4b
order
hendolim Aug 6, 2019
6919254
pylinter
hendolim Aug 6, 2019
72a91cc
python3 alias
hendolim Aug 7, 2019
2f1d972
see if machine image has python 3.4
hendolim Aug 7, 2019
4ab80ba
bashenv to set alias
hendolim Aug 7, 2019
d037777
try with basrc first
hendolim Aug 7, 2019
cfffa19
indent bash env
hendolim Aug 7, 2019
5aea308
maybe default bash env
hendolim Aug 7, 2019
4d82357
symlink py3
hendolim Aug 7, 2019
22e0725
Merge branch 'develop' into port-to-python3
hendolim Aug 7, 2019
39c89a4
try unlink python3
hendolim Aug 7, 2019
36d307e
figuring out where the pkgs are called from
hendolim Aug 7, 2019
bb95489
figuring out where the pkgs are called from
hendolim Aug 7, 2019
209fb58
figuring out where the pkgs are called from
hendolim Aug 7, 2019
0126085
figuring out where the pkgs are called from
hendolim Aug 7, 2019
9a8aa06
figuring out where the pkgs are called from
hendolim Aug 7, 2019
1398454
figuring out where the pkgs are called from
hendolim Aug 7, 2019
c569000
figuring out where the pkgs are called from
hendolim Aug 7, 2019
15b15bd
might be able to use pyenv
hendolim Aug 7, 2019
f18e70c
might be able to use pyenv
hendolim Aug 7, 2019
b9c866a
might be able to use pyenv
hendolim Aug 7, 2019
b20e730
might be able to use pyenv
hendolim Aug 7, 2019
d1c4e49
might be able to use pyenv
hendolim Aug 7, 2019
d0723f3
might be able to use pyenv
hendolim Aug 7, 2019
fc32c77
might be able to use pyenv
hendolim Aug 7, 2019
a555747
might be able to use pyenv
hendolim Aug 7, 2019
b3afccc
resolved clashing pyenv python3
hendolim Aug 7, 2019
8f65207
properlu update python3
hendolim Aug 7, 2019
7b30744
properlu update python3
hendolim Aug 7, 2019
2e5da74
properlu update python3
hendolim Aug 7, 2019
78a5831
properlu update python3
hendolim Aug 7, 2019
266aa62
properlu update python3
hendolim Aug 7, 2019
22afcd5
properlu update python3
hendolim Aug 7, 2019
bd3764a
properlu update python3
hendolim Aug 7, 2019
597d7e2
properlu update python3
hendolim Aug 7, 2019
83fa915
pip3 on path
hendolim Aug 7, 2019
c321cb1
path source
hendolim Aug 7, 2019
2adcbea
path source
hendolim Aug 7, 2019
bbc8478
custom python3
hendolim Aug 7, 2019
3f56e57
custom python3
hendolim Aug 7, 2019
f51b802
use pyenv preference order to make python2 and 3 exists concurrently
hendolim Aug 8, 2019
2b3a4ba
update pyenbv
hendolim Aug 8, 2019
d30c7d0
use py2 and py3 default version from pyenv
hendolim Aug 8, 2019
8f3547c
adding pylint
hendolim Aug 8, 2019
04c7669
disable pylint for now
hendolim Aug 8, 2019
07c9790
test python3 installation inside container
hendolim Aug 10, 2019
fd87589
format
hendolim Aug 10, 2019
7100176
published version ci
hendolim Aug 11, 2019
5c1e5a8
empty commit
hendolim Aug 11, 2019
42a33f6
epel repo works
hendolim Aug 12, 2019
33a0b42
use 3.7.4
hendolim Aug 12, 2019
816489d
use 3.7.4
hendolim Aug 12, 2019
d972c6d
use 3.7.4
hendolim Aug 12, 2019
5188aad
py5
hendolim Aug 12, 2019
e3e399b
python default version check
hendolim Aug 13, 2019
d74bb02
ci config indent
hendolim Aug 13, 2019
0bf6275
additional image layer for python2&3
hendolim Aug 17, 2019
5b32318
added test for image size increase
hendolim Aug 17, 2019
c1366b7
adding image size test to ci
hendolim Aug 17, 2019
7c64d3e
fix image size test
hendolim Aug 19, 2019
0570ed7
Merge branch 'develop' into port-to-python3
Aug 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ jobs:
steps:
- checkout
- run:
name: Build Container
name: Setup python3
command: |
make all
pyenv global 2.7.12 3.5.2
python --version
pip --version
python3 --version
pip3 --version
- run:
name: Setup Tests / Scanner Requirements
command: |
make test_setup
- run:
name: Build Container
command: |
make all
- run:
name: Export Build Images for Artifacts
command: |
Expand All @@ -26,7 +34,16 @@ jobs:
path: clair-scanner-logs
destintation: clair-scanner-logs
- run:
name: Running CI Tests
name: Test Python3 installation
command: make test_python3_all
- run:
name: Test Python2 as the default
command: make test_python2_all
- run:
name: Test if image size increase
command: make test_debian9_image_size
- run:
name: Running debian9 CI Tests
command: make run_tests_debian9
no_output_timeout: 20m
- store_artifacts:
Expand Down
150 changes: 146 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ SCANNER_DATE := `date +%Y-%m-%d`
SCANNER_DATE_YEST := `TZ=GMT+24 +%Y:%m:%d`
SCANNER_VERSION := v8
SCANNER_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)
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
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
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
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
ifeq ($(shell uname), Linux)
SCANNER_FILE = clair-scanner_linux_amd64
else ifeq ($(shell uname), Darwin)
Expand All @@ -44,7 +44,7 @@ endif

.PHONY: tests interactive_tutorials

all: splunk uf
all: splunk uf splunk-py23 uf-py23

ansible:
@if [ -d "splunk-ansible" ]; then \
Expand Down Expand Up @@ -225,6 +225,61 @@ uf-windows-2016: base-windows-2016 ansible
--build-arg SPLUNK_BUILD_URL=${UF_WIN_BUILD_URL} \
-t uf-windows-2016:${IMAGE_VERSION} .


##### Python 3 support #####
splunk-py23: splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8

splunk-py23-debian-9: splunk-debian-9
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/debian-9/Dockerfile \
--build-arg SPLUNK_PRODUCT=splunk \
-t splunk-py23-debian-9:${IMAGE_VERSION} .

splunk-py23-debian-10: splunk-debian-10
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/debian-10/Dockerfile \
--build-arg SPLUNK_PRODUCT=splunk \
-t splunk-py23-debian-10:${IMAGE_VERSION} .

splunk-py23-centos-7: splunk-centos-7
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/centos-7/Dockerfile \
--build-arg SPLUNK_PRODUCT=splunk \
-t splunk-py23-centos-7:${IMAGE_VERSION} .

splunk-py23-redhat-8: splunk-redhat-8
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/redhat-8/Dockerfile \
--build-arg SPLUNK_PRODUCT=splunk \
-t splunk-py23-redhat-8:${IMAGE_VERSION} .

uf-py23: uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8

uf-py23-debian-9: uf-debian-9
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/debian-9/Dockerfile \
--build-arg SPLUNK_PRODUCT=uf \
-t uf-py23-debian-9:${IMAGE_VERSION} .

uf-py23-debian-10: uf-debian-10
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/debian-10/Dockerfile \
--build-arg SPLUNK_PRODUCT=uf \
-t uf-py23-debian-10:${IMAGE_VERSION} .

uf-py23-centos-7: uf-centos-7
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/centos-7/Dockerfile \
--build-arg SPLUNK_PRODUCT=uf \
-t uf-py23-centos-7:${IMAGE_VERSION} .

uf-py23-redhat-8: uf-redhat-8
docker build ${DOCKER_BUILD_FLAGS} \
-f py23-image/redhat-8/Dockerfile \
--build-arg SPLUNK_PRODUCT=uf \
-t uf-py23-redhat-8:${IMAGE_VERSION} .


##### Tests #####
sample-compose-up: sample-compose-down
docker-compose -f test_scenarios/${SPLUNK_COMPOSE} up -d
Expand All @@ -248,14 +303,16 @@ run_tests_centos7:

run_tests_redhat8:
@echo 'Running the super awesome tests; RedHat 8'
pytest -sv tests/test_redhat_8.py --junitxml test-results/redhat8-result/testresults_redhat8.xml
pytest -sv tests/test_docker_splunk.py --platform redhat-8 --junitxml test-results/redhat8-result/testresults_redhat8.xml

test_setup:
@echo 'Install test requirements'
pip install --upgrade pip
pip install -r $(shell pwd)/tests/requirements.txt --upgrade
mkdir test-results/centos7-result || true
mkdir test-results/debian9-result || true
mkdir test-results/debian10-result || true
mkdir test-results/redhat8-result || true

run_tests_debian9:
@echo 'Running the super awesome tests; Debian 9'
Expand All @@ -270,6 +327,91 @@ save_containers:
mkdir test-results/saved_images || true
$(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; )

test_python3_all: test_splunk_python3_all test_uf_python3_all

test_splunk_python3_all: test_splunk_centos7_python3 test_splunk_redhat8_python3 test_splunk_debian9_python3 test_splunk_debian10_python3

test_uf_python3_all: test_uf_centos7_python3 test_uf_redhat8_python3 test_uf_debian9_python3 test_uf_debian10_python3

test_splunk_centos7_python3:
$(call test_python3_installation,splunk-py23-centos-7)

test_splunk_redhat8_python3:
$(call test_python3_installation,splunk-py23-redhat-8)

test_splunk_debian9_python3:
$(call test_python3_installation,splunk-py23-debian-9)

test_splunk_debian10_python3:
$(call test_python3_installation,splunk-py23-debian-10)

test_uf_centos7_python3:
$(call test_python3_installation,uf-py23-centos-7)

test_uf_redhat8_python3:
$(call test_python3_installation,uf-py23-redhat-8)

test_uf_debian9_python3:
$(call test_python3_installation,uf-py23-debian-9)

test_uf_debian10_python3:
$(call test_python3_installation,uf-py23-debian-10)

define test_python3_installation
docker run -d --rm --name $1 -it $1 bash
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'
docker kill $1
endef

test_python2_all: test_splunk_python2_all test_uf_python2_all

test_splunk_python2_all: test_splunk_centos7_python2 test_splunk_redhat8_python2 test_splunk_debian9_python2 test_splunk_debian10_python2

test_uf_python2_all: test_uf_centos7_python2 test_uf_redhat8_python2 test_uf_debian9_python2 test_uf_debian10_python2

test_splunk_centos7_python2:
$(call test_python2_installation,splunk-py23-centos-7)

test_splunk_redhat8_python2:
$(call test_python2_installation,splunk-py23-redhat-8)

test_splunk_debian9_python2:
$(call test_python2_installation,splunk-py23-debian-9)

test_splunk_debian10_python2:
$(call test_python2_installation,splunk-py23-debian-10)

test_uf_centos7_python2:
$(call test_python2_installation,uf-py23-centos-7)

test_uf_redhat8_python2:
$(call test_python2_installation,uf-py23-redhat-8)

test_uf_debian9_python2:
$(call test_python2_installation,uf-py23-debian-9)

test_uf_debian10_python2:
$(call test_python2_installation,uf-py23-debian-10)

#python2 version print to stderr, hence the 2>&1
define test_python2_installation
docker run -d --rm --name $1 -it $1 bash
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'
docker kill $1
endef

test_debian9_image_size:
$(call test_image_size,splunk-debian-9)

define test_image_size
docker pull splunk/splunk:edge
CUR_SIZE=$$(docker image inspect $1:latest --format='{{.Size}}') ; \
EDGE_SIZE=$$(docker image inspect splunk/splunk:edge --format='{{.Size}}') ; \
echo "current $1 image size = "$$CUR_SIZE ; \
echo "edge image size = "$$EDGE_SIZE ; \
if [[ $$CUR_SIZE -gt $$EDGE_SIZE*102/100 ]] ; then echo "current image size is 2% more than edge image" ; exit 1 ; fi
endef

setup_clair_scanner:
mkdir clair-scanner-logs
mkdir test-results/cucumber
Expand Down
7 changes: 7 additions & 0 deletions py23-image/centos-7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG SPLUNK_PRODUCT=splunk
FROM ${SPLUNK_PRODUCT}-centos-7:latest
USER root

RUN yum -y update
RUN yum -y install python36 python36-requests
RUN python3 -m ensurepip
7 changes: 7 additions & 0 deletions py23-image/debian-10/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG SPLUNK_PRODUCT=splunk
FROM ${SPLUNK_PRODUCT}-debian-10:latest
USER root

RUN apt update
RUN apt-get install -y --no-install-recommends python3 python3-pip python3-setuptools python3-requests python3-yaml
RUN pip3 --no-cache-dir install ansible
6 changes: 6 additions & 0 deletions py23-image/debian-9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG SPLUNK_PRODUCT=splunk
FROM ${SPLUNK_PRODUCT}-debian-9:latest
USER root

RUN apt-get update
RUN apt-get install -y --no-install-recommends python3 python3-pip python3-requests
7 changes: 7 additions & 0 deletions py23-image/redhat-8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG SPLUNK_PRODUCT=splunk
FROM ${SPLUNK_PRODUCT}-redhat-8:latest
USER root

RUN microdnf -y --nodocs install python3
RUN alternatives --set python /usr/bin/python2
RUN pip3 -q --no-cache-dir install requests ansible
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ docker
PyYAML
docker-compose
pyasn1
junit-xml
junit-xml