Use Fedora 34, Fedora 35 and CentOS 8 as base container images

Change-Id: Ie3f7d75b390009e653842699dedb68a3b0d900a7
This commit is contained in:
Federico Ressi 2022-01-05 12:15:42 +01:00
parent 31758b2400
commit 544fe81e8a
3 changed files with 103 additions and 68 deletions

View File

@ -1,37 +1,43 @@
ARG base_image=python
ARG base_image=py39
FROM centos:8 as lower-constraints
FROM python:3.10 as python
ENV INSTALL_PACKAGES="apt install -y"
ENV CONSTRAINS_FILE=upper-constraints.txt
RUN apt update && apt install -y iperf3 iputils-ping ncat
FROM python:3.8 as lower-constraints
ENV INSTALL_PACKAGES="apt install -y"
ENV CONSTRAINS_FILE=lower-constraints.txt
ENV INSTALL_PACKAGES="dnf install -y"
ENV PYTHON_VERSION=3
RUN apt update && apt install -y iperf3 iputils-ping ncat
USER 0
FROM fedora:35 as fedora
FROM fedora:34 as py39
ENV CONSTRAINS_FILE=upper-constraints.txt
ENV INSTALL_PACKAGES="dnf install -y"
ENV PYTHON_VERSION=3.9
RUN ${INSTALL_PACKAGES} iperf3 gcc python3-devel
USER 0
FROM fedora:35 as py310
ENV CONSTRAINS_FILE=upper-constraints.txt
ENV INSTALL_PACKAGES="dnf install -y"
ENV PYTHON_VERSION=3.10
USER 0
FROM ${base_image} as base
ENV TOBIKO_DIR=/tobiko
ENV WHEEL_DIR=/wheel
ENV PACKAGES_DIR=/site_packages
ENV PYTHON=python${PYTHON_VERSION}
RUN python3 -m ensurepip --upgrade && \
python3 -m pip install --upgrade setuptools wheel
RUN ${INSTALL_PACKAGES} ${PYTHON}
RUN ${PYTHON} -m ensurepip --upgrade && \
${PYTHON} -m pip install --upgrade setuptools wheel pip
FROM base as source
@ -55,8 +61,11 @@ ADD .git ${TOBIKO_DIR}/.git/
FROM source as build
RUN ${INSTALL_PACKAGES} gcc ${PYTHON}-devel
# Build wheel files
RUN python3 -m pip wheel -w ${WHEEL_DIR} \
RUN mkdir -p ${WHEEL_DIR}
RUN ${PYTHON} -m pip wheel --wheel-dir ${WHEEL_DIR} \
-c ${TOBIKO_DIR}/${CONSTRAINS_FILE} \
-r ${TOBIKO_DIR}/requirements.txt \
-r ${TOBIKO_DIR}/test-requirements.txt \
@ -69,10 +78,10 @@ FROM base as install
# Install wheels
RUN mkdir -p ${WHEEL_DIR}
COPY --from=build ${WHEEL_DIR} ${WHEEL_DIR}
RUN python3 -m pip install ${WHEEL_DIR}/*.whl
RUN ${PYTHON} -m pip install --prefix /usr/local ${WHEEL_DIR}/*.whl
FROM source as tobiko
FROM source as test
# Run tests variables
ENV PYTHONWARNINGS=ignore::Warning
@ -81,6 +90,8 @@ ENV TOX_REPORT_DIR=/report
ENV TOX_REPORT_NAME=tobiko_results
ENV TOBIKO_PREVENT_CREATE=false
RUN ${INSTALL_PACKAGES} iperf3 iputils nmap-ncat findutils procps
# Write log files to report directory
RUN mkdir -p /etc/tobiko
RUN printf "[DEFAULT]\nlog_dir=${TOBIKO_REPORT_DIR}" > /etc/tobiko/tobiko.conf
@ -95,7 +106,7 @@ WORKDIR ${TOBIKO_DIR}
CMD tools/run_tests.py ${OS_TEST_PATH}
FROM tobiko as linters
FROM test as linters
ENV SKIP=check-executables-have-shebangs,pylint
@ -104,7 +115,11 @@ ADD .pre-commit-config.yaml \
linters-requirements.txt \
${TOBIKO_DIR}/
RUN python3 -m pip install -r ${TOBIKO_DIR}/linters-requirements.txt
# Copy python pacakges
COPY --from=install /usr/local /usr/local/
# Install linters tools
RUN ${PYTHON} -m pip install -r ${TOBIKO_DIR}/linters-requirements.txt
RUN pre-commit install --install-hooks
WORKDIR ${TOBIKO_DIR}

View File

@ -2,14 +2,14 @@
version: '3.4'
services:
unit:
py3:
build:
context: .
target: tobiko
target: test
hostname: tobiko
environment:
OS_TEST_PATH: tobiko/tests/unit
TOX_REPORT_NAME: tobiko_results_unit
TOX_REPORT_NAME: tobiko_results_py3
volumes:
- ./report:/report
- .:/tobiko
@ -17,45 +17,54 @@ services:
lower-constraints:
extends:
service: unit
service: py3
build:
context: .
target: tobiko
args:
base_image: lower-constraints
environment:
TOX_REPORT_NAME: tobiko_results_lower_constraints
py39:
extends:
service: py3
build:
args:
base_image: py39
environment:
TOX_REPORT_NAME: tobiko_results_py39
py310:
extends:
service: py3
build:
args:
base_image: py310
environment:
TOX_REPORT_NAME: tobiko_results_py310
linters:
extends:
service: unit
service: py3
build:
target: linters
fedora:
extends:
service: unit
build:
context: .
target: tobiko
args:
base_image: fedora
functional:
extends:
service: unit
service: py3
environment:
OS_TEST_PATH: tobiko/tests/functional
TOX_REPORT_NAME: tobiko_results_functional
create-workloads:
extends:
service: unit
service: py3
environment:
OS_TEST_PATH: tobiko/tests/scenario
TOX_REPORT_NAME: tobiko_results_create_workloads
disrupt-services:
extends:
service: unit
service: py3
environment:
OS_TEST_PATH: tobiko/tests/faults
TOX_REPORT_NAME: tobiko_results_disrupt_services
@ -69,7 +78,7 @@ services:
verify-services:
extends:
service: unit
service: py3
environment:
OS_TEST_PATH: tobiko/tests/sanity
TOX_REPORT_NAME: tobiko_results_verify_services

View File

@ -6,12 +6,13 @@
Docker jobs intended to gate Tobiko container related changes
check: &CHECK
jobs:
- tobiko-docker
- tobiko-docker-fedora
- tobiko-docker-lower-constraints
- tobiko-docker-py3
- tobiko-docker-py39
- tobiko-docker-py310
- tobiko-docker-functional
- tobiko-docker-infrared
- tobiko-docker-linters
- tobiko-docker-lower-constraints
gate:
jobs:
- tobiko-docker-functional
@ -21,7 +22,7 @@
# ----------------------------------------------------------------------------
- job:
name: tobiko-docker
name: tobiko-docker-py3
description: |
Run unit tests for an OpenStack Python project inside a Docker container.
voting: true
@ -30,28 +31,49 @@
pre-run: playbooks/docker/pre.yaml
run: playbooks/docker/run.yaml
post-run: playbooks/docker/post.yaml
# post-run: playbooks/docker/post.yaml
vars:
docker_compose_service: unit
docker_compose_service: py3
- job:
name: tobiko-docker-fedora
name: tobiko-docker-lower-constraints
description: |
Run functional tests for an OpenStack Python project inside a Docker container
based on Fedora 35
with lower-constraints.txt Pip constraints file.
voting: true
parent: tobiko-docker
parent: tobiko-docker-py3
vars:
docker_compose_service: fedora
docker_compose_service: lower-constraints
- job:
name: tobiko-docker-py39
description: |
Run functional tests for an OpenStack Python project inside a Docker container
with Python 3.9
voting: true
parent: tobiko-docker-py3
vars:
docker_compose_service: py39
- job:
name: tobiko-docker-py310
description: |
Run functional tests for an OpenStack Python project inside a Docker container
with Python 3.10
voting: true
parent: tobiko-docker-py3
vars:
docker_compose_service: py310
- job:
name: tobiko-docker-functional
description: |
Run functional tests for an OpenStack Python project inside a Docker container.
Run functional tests for an OpenStack Python project inside a Docker container
voting: true
parent: tobiko-docker
parent: tobiko-docker-py3
timeout: 3600
vars:
docker_compose_service: functional
@ -60,9 +82,9 @@
- job:
name: tobiko-docker-infrared
description: |
Run functional tests for an OpenStack Python project inside a Docker container.
Run Tobiko InfraRed plugin inside of a Docker container
voting: true
parent: tobiko-docker
parent: tobiko-docker-py3
timeout: 3600
vars:
docker_compose_service: infrared
@ -73,17 +95,6 @@
description: |
Run static analisys verifications
voting: true
parent: tobiko-docker
parent: tobiko-docker-py3
vars:
docker_compose_service: linters
- job:
name: tobiko-docker-lower-constraints
description: |
Run functional tests for an OpenStack Python project inside a Docker container
with lower-constrains.txt requirements file.
voting: true
parent: tobiko-docker
vars:
docker_compose_service: lower-constraints